安卓阅读FB0总是给我blackscreen [英] Android read fb0 always give me blackscreen

查看:459
本文介绍了安卓阅读FB0总是给我blackscreen的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的设备的Nexus 4运行果冻豆4.2。我想记录的画面并将其发送出去。大多数codeS在互联网上做盖被读的/ dev /图形/ fb0设备。它工作正常,在一些设备和旧的系统。但是,当我尝试我的设备上,它失败。它只给我blackscreen并在原始数据全部为0。我已经运行亚行根来获得root权限,试图搭配chmod 777 FB0,猫FB0> / SD卡/ fb0设备。此外,我曾尝试codeS像MMAP和memcpy的获取数据。但全部失败。我搜索在互联网上,并似乎无解。而一些线程说,内核可能会禁止你读FB0。任何人有想法对吗?

My device is Nexus 4 running Jelly Bean 4.2. I'm trying to record the screen and send it out. Most codes on internet do the cap by read /dev/graphics/fb0. It works fine in some devices and the older systems. But when I try it on my device, it fail. It only gives me blackscreen and all "0" in the raw data. I have run "adb root" to get the root permission, tried "chmod 777 fb0", "cat fb0 > /sdcard/fb0". Also I have tried codes like "mmap" and "memcpy" to get the data. But all fail. I have searched on internet and there seems no solution. And some threads said that the kernel may forbid you reading the fb0. Anyone have idea on that?

推荐答案

随着硬件的发展,你是越来越不可能找到与屏幕内容的真实帧缓冲中了。

As the hardware advances, you're less and less likely to find an actual framebuffer with the screen contents in it.

由于在评论中指出,亚行使用screencap命令,它接触surfaceflinger通过活页夹调用,在的/ dev / graphcs / FB0 回落如果失败。后一条道路是现在很少使用。

As noted in the comments, adb uses the "screencap" command, which contacts surfaceflinger through a Binder call, falling back on /dev/graphcs/fb0 if that fails. The latter path is rarely used now.

如果你真的想钻研如何工作,你需要研究如何surfaceflinger确实成分,尤其是hwcomposer HAL。硬件作曲家需要多个gralloc面,并在扫描出的复合材料他们。这是如何工作的不同从设备到设备;所述hwcomposer执行通常由图形芯片的制造商进行。

If you really want to dig into how this works, you need to examine how surfaceflinger does composition, especially the hwcomposer HAL. The hardware composer takes multiple gralloc surfaces and composites them during scan-out. How this works differs from device to device; the hwcomposer implementation is usually done by the graphics chip manufacturer.

屏幕快照生成,使用应用程序框架生成缩略图的最近的应用程序功能,适用相同的组成步骤HWC做,但只与GLES。作为机器人4.2的,硬件作曲家是不能够合成到缓冲区中。

Screen shot generation, used by the app framework to generate the thumbnails for the "recent apps" feature, applies the same composition steps HWC does but exclusively with GLES. As of Android 4.2, the hardware composer isn't able to composite into a buffer.

有时候硬件作曲家平底船,例如因为有更多的层,以复合比硬件可以处理。在这种情况下,surfaceflinger回复到GLES组合物,并且将有一个缓冲的某处的具有完整的图像;你是否会打开的/ dev /图形/ FB0 则另当别论找到它。

Sometimes the hardware composer "punts", e.g. because there are more layers to composite than the hardware can handle. In that case, surfaceflinger reverts to GLES composition, and there will be a buffer somewhere that has the complete image; whether or not you'll find it by opening /dev/graphics/fb0 is a different matter.

一些出发点:

  • surfaceflinger
  • <一个href="https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/hwcomposer.h"相对=nofollow> hwcomposer HAL接口
  • 亚行外壳dumpsys SurfaceFlinger
  • surfaceflinger
  • hwcomposer HAL interface
  • adb shell dumpsys SurfaceFlinger

这篇关于安卓阅读FB0总是给我blackscreen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆