深入浅出CameraService的buffer管理机制

一、前言

Camera的buffer用途上主要分类:input buffer和output buffer。

  • • input buffer是有实际内容的buffer,通过reprocess流程将其送到hal,hal读取它并进行一系列的处理。
  • • output buffer是仅有一块buffer内存,里面没有具体数据,hal会将生成的数据填入到output buffer中。 在Camera2+HAL3的架构中,buffer是交由stream来管理的,configure stream流程配置的stream定义了HAL可以处理的buffer类型,每一个stream对应了系列同类型的buffer。看下Gogle对stream的定义:
什么是stream? (定义:hardware/libhardware/include/hardware/camera3.h)
A handle to a single camera input or output stream. A stream is defined by the framework by its buffer resolution and format, and additionally by the HAL with the gralloc usage flags and the maximum in-flight buffer count.
The stream structures are owned by the framework, but pointers to a camera3_stream passed into the HAL by configure_streams() are valid until the end of the first subsequent configure_streams() call that does not include that camera3_stream as an argument, or until the end of the close() call.
All camera3_stream framework-controlled members are immutable once the camera3_stream is passed into configure_streams(). The HAL may only change the HAL-controlled parameters during a configure_streams() call, except for the contents of the private pointer.
If a configure_streams() call returns a non-fatal error, all active streams remain valid as if configure_streams() had not been called.
The endpoint of the stream is not visible to the camera HAL device. In DEVICE_API_VERSION_3_1, this was changed to share consumer usage flags on streams where the camera is a producer (OUTPUT and BIDIRECTIONAL stream types) see the usage field below.

简单来说就是,stream有input stream和output stream两种类型,它定义了buffer的四个基本属性:(1) resolution (2) format (3) gralloc usage flags (4) maximun in-flight buffer count。

什么是 in-flight buff
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值