Turns out we are pretty close.  The only problem is that X still wants
to probe the pci bus.  We allow access to /dev/pci0 if
machdep.allowaperture is 0, but libpciaccess uses O_RDWR to open it.
The diff below chages this such that it tries O_RDONLY if O_RDWR fails.

Works fine with inteldrm(4), although Xorg will still print a warning
telling you to set machdep.allowaperture to 1:

[257036.053] (WW) checkDevMem: failed to open /dev/xf86 and /dev/mem
        (Operation not permitted)
        Check that you have set 'machdep.allowaperture=1'
        in /etc/sysctl.conf and reboot your machine
        refer to xf86(4) for details

Haven't tried radeondrm(4) yet.

ok?


Index: openbsd_pci.c
===================================================================
RCS file: /cvs/xenocara/lib/libpciaccess/src/openbsd_pci.c,v
retrieving revision 1.18
diff -u -p -r1.18 openbsd_pci.c
--- openbsd_pci.c       13 Aug 2013 17:24:03 -0000      1.18
+++ openbsd_pci.c       13 Feb 2014 21:42:08 -0000
@@ -599,8 +599,11 @@ pci_system_openbsd_create(void)
        for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) {
                snprintf(path, sizeof(path), "/dev/pci%d", domain);
                pcifd[domain] = open(path, O_RDWR | O_CLOEXEC);
-               if (pcifd[domain] == -1)
-                       break;
+               if (pcifd[domain] == -1) {
+                       pcifd[domain] = open(path, O_RDONLY | O_CLOEXEC);
+                       if (pcifd[domain] == -1)
+                               break;
+               }
                ndomains++;
        }
 

Reply via email to