⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 对framebuffer的研究app.htm

📁 S3C44B0X下的LCD (framebuffer)驱动资料与相关代码
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0042)http://www.fish888.com/FrameBuffer-t120970 -->
<HTML><HEAD><TITLE>对FrameBuffer的研究</TITLE>
<META content=对FrameBuffer的研究 name=description>
<META content=FrameBuffer name=keywords>
<META http-equiv=content-type content=text/html;charset=GB2312><LINK 
href="对FrameBuffer的研究.files/NewA.htm" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="对FrameBuffer的研究.files/NewJs.htm" 
type=text/javascript></SCRIPT>

<SCRIPT src="对FrameBuffer的研究.files/refresh.js"></SCRIPT>

<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY onmousemove=HideMenu()>
<DIV id=menuDiv 
style="Z-INDEX: 1000; VISIBILITY: hidden; WIDTH: 0px; POSITION: absolute; HEIGHT: 0px; BACKGROUND-COLOR: #0164f9"></DIV>
<DIV class=DIVChannel 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"></DIV>
<DIV class=DIVChannel style="PADDING-TOP: 2px"></DIV>
<DIV class=DIVTitle>
<SCRIPT language=JavaScript src="对FrameBuffer的研究.files/menu.htm" 
type=text/JavaScript></SCRIPT>

<DIV class=DIVMenu><A href="http://www.fish888.com/default.aspx">首页</A> | <A 
onmouseover=ShowMenu(menu1,100) href="http://www.fish888.com/l1-0">编程语言</A> | <A 
onmouseover=ShowMenu(menu2,100) href="http://www.fish888.com/l2-0">网站建设</A> | <A 
onmouseover=ShowMenu(menu3,100) href="http://www.fish888.com/l3-0">游戏天堂</A> | <A 
onmouseover=ShowMenu(menu4,100) href="http://www.fish888.com/l4-0">冲浪宝典</A> | <A 
onmouseover=ShowMenu(menu5,100) href="http://www.fish888.com/l5-0">网络安全</A> | <A 
onmouseover=ShowMenu(menu6,100) href="http://www.fish888.com/l6-0">操作系统</A> | <A 
onmouseover=ShowMenu(menu7,100) href="http://www.fish888.com/l7-0">软件时空</A> | <A 
onmouseover=ShowMenu(menu8,100) href="http://www.fish888.com/l8-0">硬件指南</A> | <A 
onmouseover=ShowMenu(menu9,100) href="http://www.fish888.com/l9-0">病毒相关</A> | <A 
onmouseover=ShowMenu(menu10,100) href="http://www.fish888.com/ITl10-0">IT 认证</A> 
</DIV></DIV>
<SCRIPT src=""></SCRIPT>

<DIV class=DIVBody style="MARGIN-TOP: 0px">
<DIV class=DIVContent><SPAN id=LbPath><A 
href="http://www.fish888.com/default.aspx">软讯网络</A> &gt; <A 
href="http://www.fish888.com/-l6-0">操作系统</A> &gt; <A 
href="http://www.fish888.com/-l47-0">其他操作系统</A> &gt; 对FrameBuffer的研究</SPAN> 
</DIV>
<DIV class=DIVChannel 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">【标&nbsp;&nbsp;题】:对FrameBuffer的研究<BR>【关键字】:<B>FrameBuffer</B><BR>【来&nbsp;&nbsp;源】:http://www.cublog.cn/u/19881/showart.php?id=147519<BR>
<DIV align=center>
<H1>对FrameBuffer的研究</H1></DIV>
<DIV 
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; BACKGROUND-COLOR: #ffffff">
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 100; FLOAT: right; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"></DIV>
<DIV>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-1534216445189830";
google_alternate_ad_url = "http://www.fish888.com/noad.html";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
</SCRIPT>

<SCRIPT src="对FrameBuffer的研究.files/show_ads.js" type=text/javascript>
</SCRIPT>

<SCRIPT type=text/javascript><!--
google_ad_client = "pub-1534216445189830";
google_alternate_ad_url = "http://www.fish888.com/noad.html";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
</SCRIPT>

<SCRIPT src="对FrameBuffer的研究.files/show_ads.js" type=text/javascript>
</SCRIPT>

<DIV><SPAN class=oblog_text>对FrameBuffer的研究<BR>&nbsp;&nbsp; 
&nbsp;大家都知道Unix/Linux系统是由命令驱动的。那么最基本的系统是命令行的(就是想DOS一样的界面)。X-Window- 
System是Unix/Linux上的图形系统,它是通过X-Server来控制硬件的。但有一些Linux的发行版在引导的时候就会在屏幕上出现图形,这时的图形是不可能由X来完成的,那是什么机制呢?答案是FrameBuffer。<BR>&nbsp;&nbsp; 
&nbsp;FrameBuffer不是一个图形系统,更不是窗口系统。它比X要低级,简单来说FrameBuffer就是一种机制的实现。这种机制是把屏幕上的每个点映射成一段线性内存空间,程序可以简单的改变这段内存的值来改变屏幕上某一点的颜色。X的高度可移植性就是来自于这种机制,不管是在那种图形环境下,只要有这种机制的实现就可以运行X。所以在几乎所有的平台上都有相应的X版本的移植。<BR>&nbsp;&nbsp; 
&nbsp;好了,闲话少说,下面我们来看看可以利用FrameBuffer来干点什么。首先看看你是否有了相应的驱动:找一下在/dev/下是否有fb*这个设备文件,这是个字符类的特殊文件。<BR><BR>&nbsp;ls 
-l /dev/fb0&nbsp;&nbsp; &nbsp;(Enter)&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; 
<BR>crw-rw----&nbsp; 1 root video 29, 0 Jan 27 15:32 
/dev/fb0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;<BR>如果没有这个文件也可以找找其他的比如:/dev/fb1,/dev/fb2...如果找不到这些文件,那就得重新编译内核了。下面假设存在这个文件/dev/fb0,这就是FrameBuffer的设备文件。<BR>&nbsp;&nbsp;&nbsp; 
有了这个我们可以play with 
FrameBuffer了。(一下的操作不一定要在X下,可以在启动了FrameBuffer的虚拟控制台下)<BR><BR>cat /dev/fb0 &gt; 
sreensnap <BR><BR>ls -l sreensnap<BR><BR>-rw-r--r--&nbsp; 1 wsw wsw 6291456 Jan 
27 21:30 sreensnap<BR><BR>我们得到了一个恰好6M的文件,再做下面的操作:<BR><BR>clear&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
/*清楚屏幕的输出*/<BR>cat sreensnap &gt; 
/dev/fb0<BR>是不是奇怪的事情发生了?好像是中了病毒一般?屏幕又恢复了以前的状态?不用着急,<BR><BR>clear<BR><BR>这样屏幕就正常了。<BR><BR>通过以上的操作,我想你也猜到了。文件/dev/fb0就是控制屏幕上的每一点的颜色的文件。我们可以写程序来改变这个文件的内容,就可以方便的在屏幕上画图了:-)<BR><BR>我下面就来写一个小程序,探测一下屏幕的属性。<BR><BR><BR>#include 
&lt;unistd.h&gt;<BR>#include &lt;stdio.h&gt;<BR>#include 
&lt;fcntl.h&gt;<BR>#include &lt;linux/fb.h&gt;<BR>#include 
&lt;sys/mman.h&gt;<BR><BR>int main () {<BR>&nbsp;&nbsp;&nbsp; int 
fp=0;<BR>&nbsp;&nbsp;&nbsp; struct fb_var_screeninfo 
vinfo;<BR>&nbsp;&nbsp;&nbsp; struct fb_fix_screeninfo 
finfo;<BR>&nbsp;&nbsp;&nbsp; fp = open 
("/dev/fb0",O_RDWR);<BR><BR>&nbsp;&nbsp;&nbsp; if (fp &lt; 
0){<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf("Error : Can not open 
framebuffer device\n");<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
exit(1);<BR>&nbsp;&nbsp;&nbsp; }<BR><BR>&nbsp;&nbsp;&nbsp; if 
(ioctl(fp,FBIOGET_FSCREENINFO,&amp;finfo)){<BR>&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; printf("Error reading fixed 
information\n");<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
exit(2);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; if 
(ioctl(fp,FBIOGET_VSCREENINFO,&amp;vinfo)){<BR>&nbsp;&nbsp;&nbsp; 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -