Android:为什么快照和gpu是互斥的? [英] Android: why snapshots and gpu are mutually exclusive?

查看:15
本文介绍了Android:为什么快照和gpu是互斥的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试对模拟器使用快照和 gpu 支持.但是模拟器拒绝启动:

I tried to use snapshots and gpu support for emulator both. But emulator refused to start:

模拟器:错误:快照和 gpu 在此是互斥的观点.请关闭其中一个,然后重新启动模拟器.

emulator: ERROR: Snapshots and gpu are mutually exclusive at this point. Please turn one of them off, and restart the emulator.

我想知道这些限制的原因是什么?在我看来,这不是合乎逻辑的冲突.

I wonder what is the reason for these limitations? It doesn't seems to me as logical collision.

推荐答案

Android模拟器是基于QEMU的,它必须模拟各种硬件设备,就像在真手机上运行的Android一样.具体来说,它模拟了一个名为金鱼"的神话电话.

The Android emulator is based on QEMU, which has to simulate various hardware devices as would be found by Android running on a real phone. Specifically it simulates a mythical phone called 'goldfish'.

保存快照时,设备 RAM 必须保存在快照中.但是,这不仅仅意味着主 RAM - 它还指代手机硬件的所有其他复杂位 - 例如 CPU 寄存器、实时时钟硬件的状态以及每隔一个的任何/所有寄存器此虚拟手机中的硬件.

When you save a snapshot, the device RAM must be saved in the snapshot. But, that doesn't just mean the main RAM - it also refers to all the other fiddly bits of the phone hardware - for example the CPU registers, the state of the real-time clock hardware, and any/all registers in every other piece of hardware in this virtual phone.

如果您没有启用 GPU,那么图形硬件状态就相当简单了——它将是一个帧缓冲区,以及一些代表 x 维度、y 维度和像素格式的寄存器.

If you've not enabled GPU, then the graphics hardware state is fairly simple - it will be a framebuffer, and a few registers representing the x dimension, y dimension and pixel format.

但是,如果您已启用 GPU 直通,则保存该硬件的状态会复杂得多.QEMU 必须保存每个纹理的状态、设置的相机、几何形状以及保存在 GPU 中的其他更多内容.流向 GPU 的命令流水线也必须在任意点中断,并记录这些命令的执行状态(很难,因为存在多级流水线,并且某些指令可能已部分执行).

However, if you've enabled GPU passthrough, then saving the state of that hardware would be much more complex. QEMU would have to save the state of each texture, what cameras are set up, geometry, and a squillion other more things which are kept in a GPU. The pipeline of commands flowing to the GPU would also have to be interrupted at an arbitrary point, and the state of execution of those commands recorded (hard since there's a multi-stage pipeline and some instructions may have been partially executed).

此外,qemu 实际上可能很难获取此信息,因为 qemu 只是将其传递给主机 GPU.qemu 无法准确地询问主机 GPU 驱动程序执行了什么以及没有执行什么.至少,这需要主机操作系统和 GPU 驱动程序的支持,甚至可能需要更改 GPU 管道以简化事情,以便管道可以在任意点停止和重新启动.

Moreover, it might be very hard for qemu actually to get to this information, since qemu is just passing it through to the host GPU. There's no way for qemu to ask the host GPU driver exactly what's been executed and what hasn't. At the very least, this would require support by the host operating system and GPU driver, and it might even require changes to the GPU pipeline to simplify things such that the pipeline can be stopped and restarted at arbitrary points.

这篇关于Android:为什么快照和gpu是互斥的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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