























源码:
https://cs.android.com/android/platform/superproject/main/+/main:bootable/recovery/minui/Android.bp
代码结构:

多种后端接口类型,用枚举 GraphicsBackend 表示
图像层需要实现的 MinuiBackend 后端渲染接口:

初始化 Init()
/dev/graphics/fb0/dev/dri/数字编号0~64返回下一帧渲染 Flip()

Blank() 的两个版本接口,默认和指定屏幕

多屏判断 HasMultipleConnectors()
对象资源销毁~MinuiBackend()
DRM的实现会更好点,DRM整体框架面向对象,但也看起来在内核c风格里面格格不入,像极了c里面混进去一个cpp一样。
吐槽:内核c语言经常有那种古老魔法师程序员在里面写咒语吟唱的感觉,命名千奇百怪。
附图,DRM在Linux图形架构DRI中的位置,这里recovery的minui相当于libGl



图源:https://en.wikipedia.org/wiki/Direct_Rendering_Infrastructure
这里将字体、图片、图形等等统称为绘制元素。
总所周知,xx一定要xx,所以图形界面一定要有事件。
events.cpp里面有以下:
bool should_add_input_device(int fd, bool allow_touch_inputs) int inotify_cb(int fd, __unused uint32_t epevents)int ev_init(ev_callback input_cb, bool allow_touch_inputs) int ev_get_epollfd(void) int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb) void ev_exit(void)int ev_wait(int timeout)void ev_dispatch(void) int ev_get_input(int fd, uint32_t epevents, input_event* ev) int ev_sync_sw_state(const ev_set_sw_callback& set_sw_cb)int ev_sync_key_state(const ev_set_key_callback& set_key_cb)void ev_iterate_available_keys(const std::function<void(int)>& f) void ev_iterate_touch_inputs(const std::function<void(int)>& action) 此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。