DriectFB Development notes under Fedora

Source: Internet
Author: User
System Environment: Virtual Machine Fedoralive131, ls/dev/fb *. Check that no/dev/fb0 device file is created by default. 2. After searching for information, add the fb0 device: modify/boot/grub/menu. lst adds vga = 788 at the end of the kernel startup parameter. Note: No lilo exists in Fedora13. Therefore, you need to modify the kernel startup parameter to set vga in case 7 in grub.

System Environment: Virtual Machine Fedora live 13

1. Check that no/dev/fb0 file is created in the default startup mode in ls/dev/fb *.

2. After searching for information, add the fb0 device:

Modify/boot/grub/menu. lst

Add vga = 788 at the end of the kernel startup Parameter

Note:

Lilo is not found in Fedora 13, so the kernel startup parameters need to be modified in grub.

Vga lower case

788 meaning (search for linux vga parameters online) is 800*600 16-bit true color

# Normal VGA console
# Vga = normal
# VESA framebuffer console @ 1024x768x64 k
# Vga = 1, 791
# VESA framebuffer console @ 1024x768x32 k
# Vga = 1, 790
# VESA framebuffer console @ 1024x768x256
# Vga = 1, 773
# VESA framebuffer console @ 800x600x64 k
# Vga = 1, 788
# VESA framebuffer console @ 800x600x32 k
# Vga = 1, 787
# VESA framebuffer console @ 800x600x256
# Vga = 1, 771
# VESA framebuffer console @ 640x480x64 k
# Vga = 1, 785
# VESA framebuffer console @ 640x480x32 k
# Vga = 1, 784
# VESA framebuffer console @ 640x480x256
# Vga = 1, 769

3. How to switch between the console and the graphic interface:

Ctrl + alt + f1 enter the graphic interface

Ctrl_alt + f2 Go To The tty2 Console

4. Switch to the graphic interface

Open Console

Cat/dev/fb0>/root/screensnap

Ls-l/root/screensnap

It is found that the file size is 1920000 (??? Why ?)

If the value is 800*600*16-bit true color, the value is 800*600*2 = 96000.

No, the fb0 file is also available in graphic mode.

Find a way to open the bitmap file and check the result.

After verification, press ctrl + alt + f2 to enter the console interface. cat/dev/fb0>/root/aaa also generates 1920000

This is inconsistent with the vga parameter set to 788 ??

5. Compile the basic test program

# Include
# Include
# Include
# Include
# Include

Int main (){
Int fp = 0;
Struct fb_var_screeninfo vinfo;
Struct fb_fix_screeninfo finfo;
Fp = open ("/dev/fb0", O_RDWR );

If (fp <0 ){
Printf ("Error: Can not open framebuffer device \ n ");
Exit (1 );
}

If (ioctl (fp, FBIOGET_FSCREENINFO, & finfo )){
Printf ("Error reading fixed information \ n ");
Exit (2 );
}
 
If (ioctl (fp, FBIOGET_VSCREENINFO, & vinfo )){
Printf ("Error reading variable information \ n ");
Exit (3 );
}

Printf ("The mem is: % d \ n", finfo. smem_len );
Printf ("The line_length is: % d \ n", finfo. line_length );
Printf ("The xres is: % d \ n", vinfo. xres );
Printf ("The yres is: % d \ n", vinfo. yres );
Printf ("bits_per_pixel is: % d \ n", vinfo. bits_per_pixel );
Close (fp );
}

The execution result is as follows:

[Root @ fedora-xbmc share] # cd fb
[Root @ fedora-xbmc fb] # ls
Test1.c
[Root @ fedora-xbmc fb] # gcc test1.c-o test1
Test1.c: In the 'main' function:
Test1.c: 15: Warning: Implicit declaration is incompatible with the built-in function 'exit'
Test1.c: 20: Warning: Implicit declaration is incompatible with the built-in function 'exit'
Test1.c: 25: Warning: Implicit declaration is incompatible with the built-in function 'exit'
[Root @ fedora-xbmc fb] #./test1
The mem is 1920000
The line_length is: 1600
The xres is: 800
The yres is: 600
Bits_per_pixel is: 16
[Root @ fedora-xbmc fb] #

The configuration of fb0 is basically completed to prepare for subsequent development and verification. Unfortunately, the cat results have not been fully understood.

Finally:

Based on the above article, we can basically conclude that the cat result is twice that of the whole screen because:

This is because there are many buffer technologies in the Modern Graphic System, and there are two pages of screen data in the video memory, which is convenient and fast to change the screen content to achieve relatively high requirements such as animation.

Which of the following machines knows whether the vga parameter can be set to 32-bit true color? (Transparent Bit is required.) What is the parameter value?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.