Chinaunix首页 | 论坛 | 博客
  • 博客访问: 243864
  • 博文数量: 72
  • 博客积分: 2592
  • 博客等级: 少校
  • 技术积分: 834
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-28 00:16
文章分类

全部博文(72)

文章存档

2014年(1)

2012年(1)

2011年(6)

2010年(12)

2009年(19)

2008年(28)

2007年(4)

2005年(1)

我的朋友

分类: LINUX

2009-06-20 21:54:53

    话未完毕,AMD/ATI的TTM+KMS已经进git了……
    所以,还是得抓紧,2.6.31出来,就更复杂了。GEM+TTM两套DRM内存管理子系统。开源的分裂或自由,随你怎么想。

    接着从i915.ko的编译文件出发。drivers/gpu/drm/i915/i915_drv.c
   
static unsigned int i915_modeset = -1;
module_param_named(modeset, i915_modeset, int, 0400);

   
    这几行代码,就是处理grub中,给内核传的参数"i915.modeset=1".

    很简单,所以看看变量“i915_modeset”如何影响代码执行的。直接跳到i915_init函数。
   
 #if defined(CONFIG_DRM_I915_KMS)
        if (i915_modeset != 0)
                driver.driver_features |= DRIVER_MODESET;
#endif
        if (i915_modeset == 1)
                driver.driver_features |= DRIVER_MODESET;

#ifdef CONFIG_VGA_CONSOLE
        if (vgacon_text_force() && i915_modeset == -1)
                driver.driver_features &= ~DRIVER_MODESET;
#endif
   
   只是影响一些flag的。关系到KMS是否开启。

   分析函数, 大头的是结构体“static struct drm_driver driver”里面的函数回调。
   先贴一段:
  
 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,
        .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,
};

   粗略看了一下,
        .gem_init_object = i915_gem_init_object,
        .gem_free_object = i915_gem_free_object,
        .gem_vm_ops = &i915_gem_vm_ops,
        .ioctls = i915_ioctls,
        ...
        .ioctl = drm_ioctl,
        .mmap = drm_gem_mmap,

   将是分析的难点.
   "struct drm_ioctl_desc i915_ioctls[]" 又是N多的回调函数……

 

   
阅读(6675) | 评论(0) | 转发(1) |
0

上一篇:欺实马与CSI

下一篇:DRM内核源码分析之三

给主人留下些什么吧!~~