summaryrefslogtreecommitdiff
authorHans Ulrich Niedermann <hun@n-dimensional.de>2009-12-07 10:38:06 (GMT)
committer Egbert Eich <eich@freedesktop.org>2010-01-18 17:53:28 (GMT)
commit56fa25f40baa91b1f05a32cd5e4add96a07d8e61 (patch) (side-by-side diff)
tree9ba91a5f06c26d5fccb61067d3c142e2788b8a2b
parent83e0afd3af55f4876f3140abfade949767fb5be5 (diff)
downloadxf86-video-radeonhd-56fa25f40baa91b1f05a32cd5e4add96a07d8e61.zip
xf86-video-radeonhd-56fa25f40baa91b1f05a32cd5e4add96a07d8e61.tar.gz
Probe: Only allow this driver when KMS is not present.
If kernel modesetting (KMS) is detected and active, we abort the PciProbe and do not touch the GPU in any way. Then at least the KMS console continues working, and there is an error message for the user to read. This is only temporary until KMS has been added to this driver.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/rhd_driver.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/rhd_driver.c b/src/rhd_driver.c
index 2d7f803..a7447f3 100644
--- a/src/rhd_driver.c
+++ b/src/rhd_driver.c
@@ -2,6 +2,8 @@
* Copyright 2007-2009 Luc Verhaegen <libv@exsuse.de>
* Copyright 2007-2009 Matthias Hopf <mhopf@novell.com>
* Copyright 2007-2009 Egbert Eich <eich@novell.com>
+ * Copyright 2009 Dave Airlie <airlied@redhat.com>
+ * Copyright 2009 Hans Ulrich Niedermann <hun@n-dimensional.de>
* Copyright 2007-2009 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -88,6 +90,7 @@
#define _XF86DRI_SERVER_
#include "dri.h"
#include "GL/glxint.h"
+#include "xf86drmMode.h"
#endif
#if HAVE_XF86_ANSIC_H
@@ -398,6 +401,34 @@ RHDAvailableOptions(int chipid, int busid)
*
*/
#ifdef XSERVER_LIBPCIACCESS
+
+/* The radeon_kernel_mode_enabled() function is taken verbatim from
+ * radeon's radeon_probe.c file. */
+static Bool radeon_kernel_mode_enabled(ScrnInfoPtr pScrn, struct pci_device *pci_dev)
+{
+ char *busIdString;
+ int ret;
+
+ if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "[KMS] No DRICreatePCIBusID symbol, no kernel modesetting.\n");
+ return FALSE;
+ }
+
+ busIdString = DRICreatePCIBusID(pci_dev);
+ ret = drmCheckModesettingSupported(busIdString);
+ xfree(busIdString);
+ if (ret) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "[KMS] drm report modesetting isn't supported.\n");
+ return FALSE;
+ }
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "[KMS] Kernel modesetting enabled.\n");
+ return TRUE;
+}
+
static Bool
RHDPciProbe(DriverPtr drv, int entityNum,
struct pci_device *dev, intptr_t matchData)
@@ -409,6 +440,21 @@ RHDPciProbe(DriverPtr drv, int entityNum,
RES_SHARED_VGA, NULL, NULL, NULL, NULL);
if (pScrn != NULL) {
+ if (dev) {
+ Bool kms = radeon_kernel_mode_enabled(pScrn, dev);
+ if (kms) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 0,
+ "FATAL: RADEONHD does not work with kernel modesetting (KMS).\n"
+ "\tAppend \"nomodeset\" or \"radeon.modeset=0\" (depending\n"
+ "\ton your kernel version, or just add both to be sure) to \n"
+ "\tyour kernel command line in /boot/grub/grub.conf.\n");
+ return FALSE;
+ } else {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 0,
+ "KMS is disabled. This is good for us, because RADEONHD conflicts with KMS.\n");
+ }
+ }
+
pScrn->driverVersion = RHD_VERSION;
pScrn->driverName = RHD_DRIVER_NAME;
pScrn->name = RHD_NAME;