关闭

UNDERSTANDING ANDROID GRAPHICS INTERNALS – GRALLOC AND HWCOMPOSER

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

gralloc and hwcomposer are hardware abstraction modules compliant to hw_module_t (defined in hardware/libhardware/include/hardware/hardware.h). Vendors mostly overwrite the android release implementation to suite their hardware platforms for optimal performance.

  • gralloc

Gralloc’s hardware module ide is GRALLOC_HARDWARE_MODULE_ID and hosts two hw_device_t instances with the name of GRALLOC_HARDWARE_GPU0 and GRALLOC_HARDWARE_FB0 respectively.

The GRALLOC_HARDWARE_GPU0 device provides the APIs to allocate and release graphic buffer memory from ashmem driver; in case GRALLOC_USAGE_HW_FB is set, the buffer memory will be allocated from the frame buffer device, which are physically contiguous. In SurfaceFlinger FramebufferSurface handles frame buffer allocation. The number of frame buffer to allocate is macro defined in NUM_FRAMEBUFFER_SURFACE_BUFFERS. The default value is 2.

In the framework, a singleton utility class GraphicBufferMapper (defined in frameworks/native/include/ui/GraphicBufferMapper.h) helps the mapping/unmapping of buffer_handle_t instance to virtual memory address, and register/unregister a remote buffer_handle_t instance allocated out of the process. You may GraphicBuffer has a field to get a per process reference to the singleton class.

The GRALLOC_HARDWARE_FB0 device exposes methods to set frame swap interval  and post a frame for rendering; it also exposes typical frame buffer device parameters for querying, which include frame buffer flags, geometrical sizes, resolutions, color scheme etc.

In SurfaceFlinger, the GRALLOC_HARDWARE_FB0 device is managed by HWComposer class; The latter manages the hwcomposer module as well.

  • hwcomposer

Its hardware module id is HWC_HARDWARE_MODULE_ID; It contains one device with the name  of HWC_HARDWARE_COMPOSER.  hwcomposer’s functionality is well documented in hardware/libhardware/include/hwcomposer.h. You may view the file from the link (https://github.com/android/platform_hardware_libhardware/blob/master/include/hardware/hwcomposer.h)

The (*prepare)() and (*set)() methods in the abstract device are two methods to determine whether a surface layer shall be rendered through overlay and trigger the frame buffer switch respectively. The (*eventControl)() is for vsync purpose.

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

Android graphics 学习-生产者、消费者、BufferQueue介绍

备注:博文根据Android5.1代码分析,为个人学习笔记。如有问题,欢迎指正。   博文是后续理解Camera preview,recording buffer流转的基础。要不然后续Camera ...
  • armwind
  • armwind
  • 2017-06-18 22:52
  • 1881

SQL Server 2012内部原理及故障排除(专栏)

SQL Server 2012内部原理和故障排除(PROFESSIONAL SQL SERVER® 2012 INTERNALS AND TROUBLESHOOTING)一书对于你全面理解SQL Se...
  • Burgess_Liu
  • Burgess_Liu
  • 2014-07-17 09:34
  • 3088

Android 开发技巧 - Android 6.0 以上权限大坑和权限检查基类封装

关于运行时权限的说法,早在Google发布android 6.0的时候,大家也听得蛮多的。从用户的角度来讲,用户是受益方,更好的保护用户的意思,而对于开发者来说,无疑增加了工作量。 对于6.0以下的...
  • chenyk_kevin_1
  • chenyk_kevin_1
  • 2016-08-28 13:19
  • 1259

ASP.NET Internals – IIS and the Process Model (IIS5, IIS6)

Introduction Microsoft Active Server Pages, also known as ASP, since its first release in late ...
  • garcon1986
  • garcon1986
  • 2011-08-19 02:50
  • 1023

Understanding Photometric and Radiometric units and their application to computer graphics

参考: http://mentalraytips.blogspot.com/2007/03/understanding-photometric-and.html Understanding Phot...
  • aa20274270
  • aa20274270
  • 2016-07-28 21:57
  • 357

Biomedical Image Understanding – Methods and Applications

  • 2015-04-22 20:37
  • 6.78MB
  • 下载

Data Analysis and Graphics Using R –An Introduction.pdf

  • 2015-03-23 12:19
  • 628KB
  • 下载

Books, Papers and Links – Computer Graphics

Hi People,  In this post i will make an extensive list with links and materials about computer gra...
  • pizi0475
  • pizi0475
  • 2012-09-21 21:59
  • 1568

A-Deeper-Understanding-of-Spark-Internals(Spark内核深入理解)

这篇文章是对Spark Submit 2014会议上Aaron Davidson做的报告的PPT内容的整理,报告主要讲了Spark中shuffle过程的调优。 做了下整理,加入一些自己的理解。   G...
  • sdujava2011
  • sdujava2011
  • 2016-01-28 21:52
  • 512

Understanding JVM Internals

原文地址:http://www.cubrid.org/blog/dev-platform/understanding-jvm-internals/
  • jayceyxc635
  • jayceyxc635
  • 2015-09-06 17:40
  • 65
    个人资料
    • 访问:19843次
    • 积分:333
    • 等级:
    • 排名:千里之外
    • 原创:8篇
    • 转载:38篇
    • 译文:0篇
    • 评论:0条
    文章分类