drm_crtc结构体类型如下:
/**
* struct drm_crtc - central CRTC control structure
*
* Each CRTC may have one or more connectors associated with it. This structure
* allows the CRTC to be controlled.
*/
struct drm_crtc {
/*挂载到&drm_mode_config.crtc_list*/
struct list_head head;
/** crtc名称 */
char *name;
/** kms mode对象 */
struct drm_mode_object base;
/*primary层*/
struct drm_plane *primary;
/*鼠标层*/
struct drm_plane *cursor;
/*序号*/
unsigned index;
int cursor_x;
int cursor_y;
/*使用drm_atomic_helper_update_legacy_modeset_state更新*/
bool enabled;
/*显示时序,通过drm_atomic_helper_update_legacy_modeset_state()更新*/
struct drm_display_mode mode;
struct drm_display_mode hwmode;
int x;
int y;
/*crtc 的funcs*/
const struct drm_crtc_funcs *funcs;
//gamma相关参数
uint32_t gamma_size;
uint16_t *gamma_store;
/*驱动自定义的helper函数*/
const struct drm_crtc_helper_funcs *helper_private;
/*crtc的属性 */
struct drm_object_properties properties;
struct drm_property *scaling_filter_property;
/*crtc的state*/
struct drm_crtc_state *state;
/*记录commit链表*/
struct list_head commit_list;
};
一 drm_crtc初始化
drm_crtc_init_with_planes
__drm_crtc_init_with_planes(dev, crtc, primary, cursor, funcs, ...)
crtc->funcs = funcs //初始化funcs (如赋值struct drm_crtc_funcs vkms_crtc_funs)
//创建DRM_MODE_OBJECT_CRTC类型的drm_mode_object对象实例
ret = drm_mode_object_add(dev, &crtc->base, DRM_MODE_OBJECT_CRTC)
//将crtc->head添加到config->crtc_list中、
list_add_tail(&crtc->head, &config->crtc_list)
crtc->primary = primary //初始化primary plane
crtc->cursor = cursor //初始化 cursor plane
//将config中创建的prop_active等属性绑定到crtc->base(drm_mode_object对象);
drm_object_attach_property(&crtc->base, config->prop_active, 0);
//赋值crtc->helper_private
drm_crtc_helper_add(crtc, &vkms_crtc_helper_funcs);
crtc->helper_private = funcs; //vkms_crtc_helper_funcs
二 常用属性设置
crtc的设置主要有ACTIVE/MODE_ID属性, 其中MODE_ID属性,是设置其显示时序,常用的设置接口如下:
(1)drmModeSetCrtc
该接口设置crtc的显示buf,

本文详细解析了drm_crtc结构体,包括初始化流程、常用属性设置(如DRM_MODE_SETCRTC接口)、crtc控制接口和helper_private函数。介绍了如何通过atomic操作管理和调整CRTC状态,以及关键的gamma设置和power management操作。
分析(5)----crtc初始化&spm=1001.2101.3001.5002&articleId=122714532&d=1&t=3&u=3cf76d7790034b4c9fb0810231807a62)
1002

被折叠的 条评论
为什么被折叠?



