Android 模拟器 GPU ON

来源:互联网 发布:男生洗发水知乎 编辑:程序博客网 时间:2024/04/29 09:50

Android 模拟器 3D 加速架构

运行 Android 模拟器的有个 GPU 开关,当打开 GPU 开关 3D 加速功能将转给 HOST的 GPU, 否则就是用 Soft 3D(CPU 执行 GPU 运行), 因此勾选此项可以让3D程序运行流畅。

其设计如下:



可以参见官方 sdk/emulator/opengl/DESIGN

值得注意的是 Android 支持的 GLES 和 OPEN GL 还有区别,所以有 TRANSLATOR 模块进行转化。


Ubunu Linux 下面使用问题若干

在 windows 使用模拟器好像没有什么问题,因为 window  也是”游戏机“, opengl 驱动都是安装好的。 Ubunu Linux 下面使用问题若干。


运行模拟器

下载官方提供的 sdk on Linux 

运行 ./android  , 弹出SDK Manager界面 ,去下载 SDK支持文件

运行./android  avd, 弹出 AVD Manager界面 , 去创建一个AVD( android virtual devices), 比如 avd1

用命令运行模拟器 (如果在命令行中没有开 gpu on, 可以在参数中指定)

./emulaotr -avd avd1 -gpu on -verbose

Ubuntu下你的显卡没有安装 OpenGL

如果Ubuntu下你的显卡没有安装 OpenGL, Android 依然能启动,但根据下面的 Log 知道是用 software renderer.

Failed to create Context 0x3005

emulator: Can't start OpenGLES renderer?
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.


自编译 SDK,gpu on不能运行

如果自己编译的 sdk 还是安装上面的运行步骤, 并不能把 Android 启动,有下面的错误。


emulator: Initializing hardware OpenGLES emulation support

Failed to create Context 0x3005
emulator: KVM mode auto-enabled!

destroyOpenGLSubwindow not implemented for separate renderer process !!!
createOpenGLSubwindow not implemented for separate renderer process !!!
repaintOpenGLDisplay not implemented for separate renderer process !!!
emulator: Realistic sensor emulation is not available, since the remote controller is not accessible:


这应该是 模拟器没有自动切换为 soft 3d, 仍然向不存在的模拟器要构建的 hardware 3d 中pipe 通信,结果失败。


Virtual box中跑 ubuntu  再跑 emulator

在 Virtual box 中运行 Ubuntu 12.04, 再在启动运行运行 Android 模拟器

Android 模拟器可以运行,就是非常慢


因为Virtual box虚拟的设备没有3d设备, 得到下面的错误

emulator: Initializing hardware OpenGLES emulation support
OpenGL Warning:Failed to connect to host. Make sure 3D acceleration is enabled for this VM.


在Virtual box中勾选3D加速,再次启动 Ubuntu, 再运行 android  emulator

得到下面log,可见Virtual box提供3d 运行  android  emulator 还是有问题

Failed to create Context 0x3005
emulator: Can't start OpenGLES renderer?
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.



0 0
原创粉丝点击