From 0dbb15d7f4af4acc9915333e631c6ebd41534490 Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Sun, 23 May 2010 20:26:16 +0200 Subject: [PATCH] vesa: improve KMS detection 1) DRICreatePCIBusID belongs to xserver dri module, so when it's unavailable we can't format string for drmCheckModesettingSupported. (This situation happened to me with KMS enabled and dri module moved somewhere else by Gentoo's "eselect opengl set nvidia" switcher) Open code DRICreatePCIBusID to drop dri dependency. 2) Once we dropped dependency on dri module (which linked to libdrm), we have to link directly to libdrm. Signed-off-by: Marcin Slusarz --- src/Makefile.am | 2 +- src/vesa.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index aae7e4c..941538b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,7 +28,7 @@ AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS) $(LIBDRM_CFLAGS) vesa_drv_la_LTLIBRARIES = vesa_drv.la -vesa_drv_la_LDFLAGS = -module -avoid-version +vesa_drv_la_LDFLAGS = -module -avoid-version $(LIBDRM_LIBS) vesa_drv_ladir = @moduledir@/drivers vesa_drv_la_SOURCES = \ diff --git a/src/vesa.c b/src/vesa.c index 8c46f7b..4d50c77 100644 --- a/src/vesa.c +++ b/src/vesa.c @@ -325,20 +325,16 @@ VESASetModeParameters(vbeInfoPtr pVbe, DisplayModePtr vbemode, } #ifdef HAVE_KMS -static Bool VESAKernelModesettingEnabled (struct pci_device *device) +static Bool VESAKernelModesettingEnabled (struct pci_device *dev) { - char *busIdString; + char busIdString[20]; int ret; - if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) - return FALSE; - - busIdString = DRICreatePCIBusID(device); + snprintf(busIdString, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus, dev->dev, dev->func); ret = drmCheckModesettingSupported(busIdString); - xfree(busIdString); - return (ret == 0); + return (ret == 0); } #endif //HAVE_KMS -- 1.7.1