Dump bufferqueue核心代码
1262 void handleMessage(const Message&) override {
1263 if ((mService == nullptr) || (!mService->mFlinger)) {
1264 ALOGE("dump layer handler null");
1265 return;
1266 }
1267
1268 SurfaceFlinger* flinger = mService->mFlinger;
1269 const auto display = OSurfaceFlinger(flinger)->getDefaultDisplayDevice();
1270 Vector<sp<Layer>> layersSortedByZ;
1271 {
1272 Mutex::Autolock _l(flinger->mStateLock);
1273 flinger->mCurrentState.traverseInZOrder([&](Layer* layer) {
1274 if (!layer) {
1275 return;
1276 }
1277
1278 auto outputLayer = layer->findOutputLayerForDisplay(display.get());
1279 if (!outputLayer) {
1280 return;
1281 }
1282
1283 layersSortedByZ.add(layer);
1284 });
1285 }
1286
1287 for (auto layer : layersSortedByZ) {
1288 if (!layer) {
1289 continue;
1290 }
1291
1292 sp<GraphicBuffer> activeBuffer = layer->getBuffer();
1293 if (activeBuffer == nullptr) {
1294 continue;
1295 }
1296
1297 Rect crop;
1298
1299 sp<GraphicBuffer> outBuffer = nullptr;
1300
1301 status_t ret = OSurfaceFlinger(flinger)->captureLayers(
1302 layer, &outBuffer, display->getCompositionDataSpace(),
1303 ui::PixelFormat::RGBA_8888, crop, 1.0f, false);
1304
1305 if ((ret == NO_ERROR) && (outBuffer != nullptr)) {
1306 void *bufferPointer = nullptr;
1307 ret = outBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
1308 &bufferPointer);
1309 if ((ret != OK) || (bufferPointer == nullptr)) {
1310 ALOGE("dump layer unable to lock buffer");
1311 continue;
1312 }
1313
1314 uint32_t stride = outBuffer->getStride();
1315 uint32_t format = outBuffer->getPixelFormat();
1316 uint32_t height = outBuffer->getHeight();
1317 uint32_t bytes = bytesPerPixel(format);
1318 uint32_t size = stride * height * bytes;
1319
1320 OplusLayer::dumpToFd(mPath, stride, height, bytes, size,
1321 layer->sequence, bufferPointer, layer.get());
1322 outBuffer->unlock();
1323 } else {
1324 ALOGI("dump layer ret=%d,%d, name=%s", ret,
1325 (outBuffer != nullptr), OLayer(layer)->getName().string());
1326 }
1327 }
1328
1340 }
dump bufferqueue
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 使用环信时如果如果出现以下两个报错: "_fwrite$UNIX2003", referenced from:和 ...
- 安装XDebug后,在ajax传值调试时,用var_dump()打印变量、TP框架中dump()/halt()打印...
- 这是一篇学习和对比fastq-dump、pfastq-dump和fasterq-dump这三个工具转换SRA文件到...
- Mac 执行dump.py -l命令出现下面错误 先不要慌 去看看Python下面的依赖包是否安装了路径 找到了 ...
- 最近新发现一个工具——parallel-fastq-dump,能多线程运行fastq-dump处理SRA文件,而且...