参考代码:https://cgit.freedesktop.org/mesa/drm/tree/tests/modetest
modetest本质上是设置property,加载图片,显示单一静态图片.
main 函数
1.解析输入参数
parse_plane 图像格式,分辨率长宽,绑定的crtcid
struct plane_args 里面有:
uint32_t crtc_id;& unsigned int fb_id; 印证plane是fb与crtc的桥梁。绑定crtc与framebuffer
bool has_position;& int32_t x, y;& uint32_t w, h; 位置大小
double scale; 支持缩放
struct bo *bo;
char format_str[5];& unsigned int fourcc; 图像格式
parse_connector 图像格式,绑定的ctrcid,connectorid,刷新率
贴一段pipe_args的注释:
Mode setting with the kernel interfaces is a bit of a chore.
First you have to find the connector in question and make sure the requested mode is available.
Then you need to find the encoder attached to that connector so you can bind it with a free crtc.
这也是为什么结构体叫做pipe_args.你需要对应crtc->encoder->connector;而这个通路,称为pipe
struct pipe_args 里面有:
const char **cons;& uint32_t *con_ids;& unsigned int num_cons; connector名字,数量,id
uint32_t crtc_id;& struct crtc *crtc; 真正的crtc结构体和crtc id
char mode_str[64];& drmModeModeInfo *mode; &unsigned int vrefresh; 图像模式
char format_str[5];&