fwiw, I found a couple more places assuming a PCI device (dri2_get_driver_for_fd() and drm_fd_get_pci_id()).. I'm kinda thinking it would make sense to refactor this out a bit into a common load_me_the_right_driver() type fxns..
BR, -R On Fri, Jul 19, 2013 at 3:13 PM, Thierry Reding <thierry.red...@gmail.com> wrote: > From: Thierry Reding <thierry.red...@avionic-design.de> > > When probing non-PCI DRM devices, such as those found in a lot of SoCs, > GBM errors out because it expects the device to have an associated PCI > ID which can be used to lookup the driver name in a table. > > This patch removes this restriction by using the driver name from the > drmVersion structure as a fallback if a device doesn't have an > associated PCI ID. > > Signed-off-by: Thierry Reding <thierry.red...@avionic-design.de> > Tested-by: Rob Clark <robcl...@freedesktop.org> > --- > src/gbm/backends/dri/driver_name.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/src/gbm/backends/dri/driver_name.c > b/src/gbm/backends/dri/driver_name.c > index 2ed209f..be74023 100644 > --- a/src/gbm/backends/dri/driver_name.c > +++ b/src/gbm/backends/dri/driver_name.c > @@ -30,6 +30,7 @@ > #include <string.h> > > #include <libudev.h> > +#include <xf86drm.h> > > #include "gbm_driint.h" > #define DRIVER_MAP_DRI2_ONLY > @@ -43,6 +44,7 @@ dri_fd_get_driver_name(int fd) > const char *pci_id; > char *driver = NULL; > int vendor_id, chip_id, i, j; > + drmVersionPtr version; > > udev = udev_new(); > device = _gbm_udev_device_new_from_fd(udev, fd); > @@ -56,9 +58,22 @@ dri_fd_get_driver_name(int fd) > } > > pci_id = udev_device_get_property_value(parent, "PCI_ID"); > - if (pci_id == NULL || > - sscanf(pci_id, "%x:%x", &vendor_id, &chip_id) != 2) { > - fprintf(stderr, "gbm: malformed or no PCI ID"); > + if (pci_id == NULL) { > + version = drmGetVersion(fd); > + if (!version) { > + fprintf(stderr, "gbm: cannot get DRM module version\n"); > + goto out; > + } > + > + driver = strndup(version->name, version->name_len); > + _gbm_log("using driver %s for %d\n", driver, fd); > + > + drmFreeVersion(version); > + goto out; > + } > + > + if (sscanf(pci_id, "%x:%x", &vendor_id, &chip_id) != 2) { > + fprintf(stderr, "gbm: malformed PCI ID"); > goto out; > } > > -- > 1.8.1.5 > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev