Bug 95703

Summary: i915 DRI driver doesn't work
Product: Base System Reporter: Dmitriy Marchenko <_pppp>
Component: kernAssignee: Eric Anholt <anholt>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Dmitriy Marchenko 2006-04-13 17:40:14 UTC
Eric Anholt commited the i915 DRI driver to RELENG_6. I was one of the testers last autumn. The driver doesn't actually work without a patch (provided in the "Fix" section). It would be a nice idea to have a working driver in 6.1 release; not only announce the new feature which doesn't actually work.

Fix: Apply the following patch:

-       vendor = pci_get_vendor(dev);
-       device = pci_get_device(dev);
+       if (!strcmp(device_get_name(dev), "drmsub"))
+               realdev = device_get_parent(dev);
+       else
+               realdev = dev;
+
+       vendor = pci_get_vendor(realdev);
+       device = pci_get_device(realdev);

        id_entry = drm_find_description(vendor, device, idlist);
        if (id_entry != NULL) {
@@ -167,14 +173,17 @@
        drm_device_t *dev;
        drm_pci_id_list_t *id_entry;
        int unit;
+       int subdevice = 0;
+       device_t parentdev = device_get_parent( nbdev );

        unit = device_get_unit(nbdev);
        dev = device_get_softc(nbdev);

-       if (!strcmp(device_get_name(nbdev), "drmsub"))
-               dev->device = device_get_parent(nbdev);
-       else
-               dev->device = nbdev;
+       if (!strcmp(device_get_name(nbdev), "drmsub")) {
+               parentdev = device_get_parent(nbdev);
+               subdevice = 1;
+       }
+       dev->device = subdevice ? parentdev : nbdev;

        dev->devnode = make_dev(&drm_cdevsw,
                        unit,
@@ -186,8 +195,9 @@
        mtx_init(&dev->dev_lock, "drm device", NULL, MTX_DEF);
 #endif

-       id_entry = drm_find_description(pci_get_vendor(nbdev),
-           pci_get_device(nbdev), idlist);
+       id_entry = drm_find_description(
+                       pci_get_vendor(subdevice ? parentdev : nbdev),
+                       pci_get_device(subdevice ? parentdev : nbdev), idlist);
        dev->id_entry = id_entry;

        return drm_load(dev);
@@ -519,8 +529,9 @@
        }

        if (dev->driver.use_agp) {
-               if (drm_device_is_agp(dev))
-                       dev->agp = drm_agp_init();
+               if (drm_device_is_agp(dev) ||
+                       !strcmp(device_get_name(dev->device), "agp"))
+                               dev->agp = drm_agp_init();
                if (dev->driver.require_agp && dev->agp == NULL) {
                        DRM_ERROR("Card isn't AGP, or couldn't initialize "
                            "AGP.\n");


extern devclass_t drm_devclass;
-DRIVER_MODULE(i915, pci, i915_driver, drm_devclass, 0, 0);
+DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0);
 MODULE_DEPEND(i915, drm, 1, 1, 1);

 #elif defined(__NetBSD__) || defined(__OpenBSD__)--CCf6ldXl21WnCT1dqkqM9TjEfJ47MUISzJGZQIC01HTKnxG8
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

diff -ur dev/drm.orig/drm_drv.c dev/drm/drm_drv.c
--- dev/drm.orig/drm_drv.c      Wed Nov 30 16:22:19 2005
+++ dev/drm/drm_drv.c   Wed Nov 30 18:08:54 2005
@@ -149,9 +149,15 @@
 {
        drm_pci_id_list_t *id_entry;
        int vendor, device;
+       device_t realdev;
How-To-Repeat: Run X server on any modern Intel integrated graphics card.
The driver will attach as /dev/dri/card1 instead of /dev/dri/card0 and hardware acceleration won't work.
Comment 1 Matteo Riondato freebsd_committer freebsd_triage 2006-04-14 08:34:39 UTC
Responsible Changed
From-To: freebsd-bugs->anholt

Assign to DRI maintainer
Comment 2 Eric Anholt freebsd_committer freebsd_triage 2006-05-20 20:24:10 UTC
State Changed
From-To: open->closed

With the merge I committed this week, i915 works for me now.