drm core

drm core初始化

/**
 * drm_sysfs_init - initialize sysfs helpers
 *
 * This is used to create the DRM class, which is the implicit parent of any
 * other top-level DRM sysfs objects.
 *
 * You must call drm_sysfs_destroy() to release the allocated resources.
 *
 * Return: 0 on success, negative error code on failure.
 */
int drm_sysfs_init(void)
{
	int err;

	drm_class = class_create(THIS_MODULE, "drm");//sys/class/drm
	if (IS_ERR(drm_class))
		return PTR_ERR(drm_class);

	err = class_create_file(drm_class, &class_attr_version.attr);
	if (err) {
		class_destroy(drm_class);
		drm_class = NULL;
		return err;
	}

	drm_class->devnode = drm_devnode;
	drm_setup_hdcp_srm(drm_class);
	return 0;
}

drm core 
static int __init drm_core_init(void)
{
	int ret;

	drm_connector_ida_init();
	idr_init(&drm_minors_idr);

	ret = drm_sysfs_init();//drm sysfs
	if (ret < 0) {
		DRM_ERROR("Cannot create DRM class: %d\n", ret);
		goto error;
	}

	drm_debugfs_root = debugfs_create_dir("dri", NULL);//sys/kernel/debug/dri

	ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
	if (ret < 0)
		goto error;

	drm_core_init_complete = true;

	DRM_DEBUG("Initialized\n");
	return 0;

error:
	drm_core_exit();
	return ret;
}

module_init(drm_core_init);


sysfs node
ls -l /sys/kernel/debug/dri/0/
总用量 0
-r--r--r-- 1 root root 0 1月   1  2020 clients
drwxr-xr-x 2 root root 0 1月   1  2020 crtc-0
drwxr-xr-x 2 root root 0 1月   1  2020 crtc-1
-r--r--r-- 1 root root 0 1月   1  2020 framebuffer
-r--r--r-- 1 root root 0 1月   1  2020 gem_names
drwxr-xr-x 2 root root 0 1月   1  2020 HDMI-A-1
-r--r--r-- 1 root root 0 1月   1  2020 internal_clients
-r--r--r-- 1 root root 0 1月   1  2020 name
-r--r--r-- 1 root root 0 1月   1  2020 state
drwxr-xr-x 2 root root 0 1月   1  2020 VGA-1

sys/class/drm 
ls -l /sys/class/drm/
总用量 0
lrwxrwxrwx 1 root root    0 1月   1  2020 card0 -> ../../devices/pci0000:00/0000:00:03.0/0000:04:00.0/drm/card0
lrwxrwxrwx 1 root root    0 1月   1  2020 card0-HDMI-A-1 -> ../../devices/pci0000:00/0000:00:03.0/0000:04:00.0/drm/card0/card0-HDMI-A-1
lrwxrwxrwx 1 root root    0 1月   1  2020 card0-VGA-1 -> ../../devices/pci0000:00/0000:00:03.0/0000:04:00.0/drm/card0/card0-VGA-1
lrwxrwxrwx 1 root root    0 1月   1  2020 renderD128 -> ../../devices/pci0000:00/0000:00:03.0/0000:04:00.0/drm/renderD128
lrwxrwxrwx 1 root root    0 1月   1  2020 ttm -> ../../devices/virtual/drm/ttm
-r--r--r-- 1 root root 4096 1月   1  2020 version

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值