关闭

UNDERSTANDING ANDROID GRAPHICS INTERNALS – SURFACEFLINGER (II)

133人阅读 评论(0) 收藏 举报
分类:

Prior to Jelly Bean, the threadLoop in SurfaceFlinger.cpp processes composition and rendering sequentially in a thread loop. Newly enqueued graphic buffer won’t be handled until the rendering of current frame buffer is complete. As a result, animation shown on display may appear jumpy or tearing in rendering. To address this issue, Android introduces vsync event into SurfaceFlinger.

In android, a vsync event relates to timestamp. For each display device, android assigns a DisplayEventReceiver::Event  ( defined in framework/native/include/gui/DisplayEventReceiver.h) structure, i.e. mVSyncEvent. mVSyncEvent.header.timestamp. Even though the timestamp value is refreshed with system time, the significance is whether it is non-zero. If it is nonzero, SurfaceFlinger will trigger either a refresh action or an invalidate action on the corresponding display and reset timestamp to zero.

vsync events can be generated from several sources.

  • Periodical vsync event sources

If hwcomposer module is present, it will be generated either from the vsync signal emitted from the frame buffer device driver; or faked from the hwcomposer module.

If the hwcomposer module is not present, the VSyncThread will generate it.

  • Spontaneous vsync event sources

A UI view may instantiate DisplayEventReceiver and thus obtain an IDisplayEventConnection interface through createDisplayEventConnection() call. Whenever the view has a graphic buffer to update, it may sound a requestNextVsync() call on the IDisplayEventConnection interface.

To establish concurrency between composition and rendering, SurfaceFlinger in Jelly Bean made two major changes in threading model and asynchrocy, adding a new EventThread thread to handle DisplayEventReceiver::Event events, adopted a Looper/Handler/MessageQueue paradigm in SurfaceFlinger main thread. As a side note, the EventThread also handles display hotplug event ( hwcomposer module may listen on uevent).

0
0
查看评论
发表评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场

SurfaceFlinger中图像合成流程

android中图像的显示是通过HWComposer合成的,(不支持硬件composer的不考虑,现在基本都支持)。 硬件支持合成就是你输入多路视频,图像信号,出来一路合成好的数据。 硬件合成只支持...
  • u014409795
  • u014409795
  • 2016-05-09 17:20
  • 736

App的启动过程(8)surfaceflinger的启动

接下来就是怎样把BufferQueue中数据,也就是GraphicBuffer中的数据显示到屏幕上,这就是surfaceflinger做的事情。          先说surfaceflinger的...
  • lin20044140410
  • lin20044140410
  • 2017-06-01 17:37
  • 415

Android6.0 显示系统(五) SurfaceFlinger服务

SurfaceFlinger是一个独立的进程,我们来看下init.rc关于SurfaceFlinger的代码,我们可以看到SurfaceFlinger是属于core服务的。 service surfa...
  • kc58236582
  • kc58236582
  • 2016-10-10 10:57
  • 5887

Android中实现对/system/bin/surfaceflinger进程进行拦截和注入

对于Android for arm上的so注入(inject)和挂钩(hook),网上已有牛人给出了代码-libinject(http://bbs.pediy.com/showthread.php?t...
  • jiangwei0910410003
  • jiangwei0910410003
  • 2014-09-16 17:53
  • 10788

Android4.4深入浅出之SurfaceFlinger总体结构

Android4.4 GUI系统框架之SurfaceFlinger 一.             Android GUI框架: SurfaceFlinger:每当用户程...
  • w401229755
  • w401229755
  • 2014-08-07 16:08
  • 24768

Android4.4深入浅出之SurfaceFlinger框架-渲染一个surface(二)

SurfaceFlinger自启动之后,主要有三种类型线程参与工作: 1.binder线程,负责监控binder设备完成与客户端的交接 2.控制台事件监控线程,负责监控硬件帧缓冲区的睡眠/唤醒状态...
  • w401229755
  • w401229755
  • 2014-08-01 11:52
  • 8868

Android SurfaceFlinger服务的消息循环过程源码分析

在Android SurfaceFlinger服务启动过程源码分析中详细分析了SurfaceFlinger的整个启动过程,我们知道,在SurfaceFlinger线程执行过程中,循环调用waitFor...
  • yangwen123
  • yangwen123
  • 2013-11-09 14:19
  • 4694

Android系统Surface机制的SurfaceFlinger服务对帧缓冲区FrameBuffer的管理分析

本文的作者是罗升阳老师,之所以出现在我的博客,只是为了做笔记和方便以后自己阅看 老罗的csdn博客:http://blog.csdn.net/luoshengyang 老罗的新浪微博:ht...
  • u014209790
  • u014209790
  • 2016-11-07 13:35
  • 489

Android4.4深入浅出之SurfaceFlinger总体结构

[+]           Android4.4 GUI系统框架之SurfaceFlinger 一.       &#...
  • pashanhu6402
  • pashanhu6402
  • 2016-12-30 11:07
  • 545

android—调试命令service

在android中,可以利用service命令去做很多调试工作,例如service list命令显示系统当前所有在service manager注册的service,其命令具体使用如下,# servi...
  • lewif
  • lewif
  • 2016-02-23 15:21
  • 749
    个人资料
    • 访问:19766次
    • 积分:332
    • 等级:
    • 排名:千里之外
    • 原创:8篇
    • 转载:38篇
    • 译文:0篇
    • 评论:0条
    文章分类