接前一篇文章:KWin、libdrm、DRM从上到下全过程 —— drmModeAddFBxxx(9)
弄清楚了drivers/gpu/drm/drm_framebuffer.c中的framebuffer_check函数中for (i = 0; i < info->num_planes; i++)中的info->num_planes之后,接下来来看for循环中的内容。先看头两句代码,片段如下:
- for (i = 0; i < info->num_planes; i++) {
- unsigned int width = fb_plane_width(r->width, info, i);
- unsigned int height = fb_plane_height(r->height, info, i);
- ……
- }
fb_plane_width和fb_plane_height函数在同文件(drivers/gpu/drm/drm_framebuffer.c)中(就在framebuffer_check()的上边),代码如下:
- static int fb_plane_width(int width,
- const struct drm_format_info *format, int plane)
- {
- if (plane == 0)
- return width