drm linux 内核,Linux内核DRM实现分析——基于i915

static struct drm_driver driver = {

/* don't use mtrr's here, the Xserver or user space app should

* deal with them for intel hardware.

*/

.driver_features =

DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/

DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM,

.load = i915_driver_load,

.unload = i915_driver_unload,

.open = i915_driver_open,

.lastclose = i915_driver_lastclose,

.preclose = i915_driver_preclose,

.postclose = i915_driver_postclose,

.suspend = i915_suspend,

.resume = i915_resume,

.device_is_agp = i915_driver_device_is_agp,

.enable_vblank = i915_enable_vblank,

.disable_vblank = i915_disable_vblank,

.irq_preinstall = i915_driver_irq_preinstall,

.irq_postinstall = i915_driver_irq_postinstall,

.irq_uninstall = i915_driver_irq_uninstall,

.irq_handler = i915_driver_irq_handler,

.reclaim_buffers = drm_core_reclaim_buffers,

.get_map_ofs = drm_core_get_map_ofs,

.get_reg_ofs = drm_core_get_reg_ofs,

.master_create = i915_master_create,

.master_destroy = i915_master_destroy,

#if defined(CONFIG_DEBUG_FS)

.debugfs_init = i915_gem_debugfs_init,

.debugfs_cleanup = i915_gem_debugfs_cleanup,

#endif

.gem_init_object = i915_gem_init_object,

.gem_free_object = i915_gem_free_object,

.gem_vm_ops = &i915_gem_vm_ops,

.ioctls = i915_ioctls,

.fops = {

.owner = THIS_MODULE,

.open = drm_open,

.release = drm_release,

.ioctl = drm_ioctl,

.mmap = drm_gem_mmap,

.poll = drm_poll,

.fasync = drm_fasync,

#ifdef CONFIG_COMPAT

.compat_ioctl = i915_compat_ioctl,

#endif

},

.pci_driver = {

.name = DRIVER_NAME,

.id_table = pciidlist,

.probe = i915_pci_probe,

.remove = i915_pci_remove,

#ifdef CONFIG_PM

.resume = i915_pci_resume,

.suspend = i915_pci_suspend,

#endif

},

.name = DRIVER_NAME,

.desc = DRIVER_DESC,

.date = DRIVER_DATE,

.major = DRIVER_MAJOR,

.minor = DRIVER_MINOR,

.patchlevel = DRIVER_PATCHLEVEL,

};

在这个结构体里面,需要关注两个成员:ioctls,fops。这两个成员主要是用来给用户提供操作接口的。

其中,fops是我们通常意义上的file_operations,他作为连接用户程序和底层驱动的统一接口,也就是虚拟

文件系统。而i915_ioctls,它并不是用户程序可用的接口。用户程序使用的操作依然是fops的drm_ioctl,而

drm_ioctl会把用户的操作分发给具体的i915_ioctls。这里为什么要这样写属于DRM子系统的范畴(也许显卡

等设备需要的IOCTL操作是最复杂和重要的,所以才突出来吧)。

2  实现

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值