Mailinglist Archive: radeonhd (185 mails)

< Previous Next >
[radeonhd] [PATCH 1/2] KMS Check: Fail PciProbe() if KMS is enabled
  • From: Hans Ulrich Niedermann <hun@xxxxxxxxxxxxxxxx>
  • Date: Sat, 5 Dec 2009 12:41:35 +0100
  • Message-id: <1260013296-29257-1-git-send-email-hun@xxxxxxxxxxxxxxxx>
This copies the radeon_kernel_mode_enabled() function from radeon's
radeon_probe.c's radeon_get_scrninfo(), and puts it into
rhd_driver.c's RHDPciProbe().

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.
---
src/rhd_driver.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
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@xxxxxxxxx>
* Copyright 2007-2009 Matthias Hopf <mhopf@xxxxxxxxxx>
* Copyright 2007-2009 Egbert Eich <eich@xxxxxxxxxx>
+ * Copyright 2009 Dave Airlie <airlied@xxxxxxxxxx>
+ * Copyright 2009 Hans Ulrich Niedermann <hun@xxxxxxxxxxxxxxxx>
* 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;
--
1.6.2.5

--
To unsubscribe, e-mail: radeonhd+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: radeonhd+help@xxxxxxxxxxxx

< Previous Next >