Directfb buffer mode分析

1、 Doublebuffer 模式。

设置:

在directfbrc配置文件中添加desktop-buffer-mode=backvideo,doublebuffer模式生效。

原理:

      Directfb 创建两块 buffer, 一块是backbuffer 在后台混合各个surface用的,一块是frontbuffer用来显示的。绘画的过程是:先将各个window上的surfaceblit到backbuffer,然后再算出需要更新的区域,将backbuffer指定的区域blit到frontbuffer中。

优点:

      用户看到的效果是backbuffer 的内容更新到frontbuffer的过程,不会看到各个window上的surface的混合过程。

缺点:

这种绘图过程引进了backbuffer,增加了内存的拷贝次数。

 

2、 Frontonly 模式。

在directfbrc配置文件中添加desktop-buffer-mode=frontonly,frontonly 模式生效。

原理:

      Directfb创建一块frontbuffer来显示图像。绘图过程是:将各个window上的surfaceBlit到frontbuffer中,如果系统性能比较差的情况,可以看到各个每一个blit的过程。

优点:

      只有一块buffer,比double buffer 模式少了一次内存拷贝,速度更快些。

缺点:

      用户有可能看到各个window混合过程中的绘画过程。

 

 

Directfb的重绘过程: 都是计算出需要更新的区域,并只是重绘需要更新的区域,不需要更新的区域不重绘,提高效率。

 

 

使用建议:

      如果只使用到一个window,不需要多window的混合,frontonly 模式的效率会更高些。   

      如果同时使用到多个透明window叠加,使用double buffer效果应该会更好些。


例子:

Df_window 可以体现是上述过程:

 

Layer 的背景在最底层,设置其BackgroundImage为bgsurface。

Window2在此底层,画一个透明的矩形。

Window1在顶层,放置一幅半透明的图片,和设置一个红色的cursor。

 

在frontonly的模式下,移动顶层的window2的绘画过程:

      先擦除window2,window1和window1的重合区域,重新绘制次底层的window1,再绘制顶层的window2.。

 

在doublebuffer 的模式下,看不到擦除的过程,只看到重绘的过程。



官方解释:http://directfb.org/docs/directfbrc.5.html


desktop-buffer-mode=<mode>

Allows to control the desktop buffer mode.Whenever a window is moved, opened, closed, resized or its contents changeDirectFB recomposites the window stack at the affected region. This is done byblitting the windows together that are visible within that region. Opaquewindows are blitted directly while translucent windows are blitted using alphablending or color keying. If there's a back buffer the recomposition is notvisible since only the final result is copied into the front buffer. Without aback buffer each step of the recomposition is visible. This causes noticeableflicker unless all windows are opaque.

Supported values for <mode> are:

auto DirectFB decidesdepending on hardware capabilities. This is the default. DirectFB chooses aback buffer in video memory if the hardware supports simple blitting (copyingfrom back to front buffer). If there's no acceleration at all the back bufferis allocated in system memory since that gives much better performance foralpha blended recomposition in software and avoids reading from the videomemory when the result is copied to the front buffer.

backsystem Theback buffer is allocated in system memory. This is the recommend choice if yourhardware supports simple blitting but no alpha blending and you are going tohave many alpha blended windows.

backvideo Frontand back buffer are allocated in video memory. It's not required to set thismode explicitly because the 'auto' mode chooses it if blits are accelerated.Without accelerated blits this mode is not recommended.

frontonly Thereis no back buffer. This is the best choice if you are using opaque windows onlyand don't use any color keying.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值