summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2009-12-07 11:38:06 +0100
committerEgbert Eich <eich@freedesktop.org>2010-01-18 18:53:28 +0100
commit56fa25f40baa91b1f05a32cd5e4add96a07d8e61 (patch)
tree9ba91a5f06c26d5fccb61067d3c142e2788b8a2b
parent83e0afd3af55f4876f3140abfade949767fb5be5 (diff)
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.
-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 @@
2 * Copyright 2007-2009 Luc Verhaegen <libv@exsuse.de> 2 * Copyright 2007-2009 Luc Verhaegen <libv@exsuse.de>
3 * Copyright 2007-2009 Matthias Hopf <mhopf@novell.com> 3 * Copyright 2007-2009 Matthias Hopf <mhopf@novell.com>
4 * Copyright 2007-2009 Egbert Eich <eich@novell.com> 4 * Copyright 2007-2009 Egbert Eich <eich@novell.com>
5 * Copyright 2009 Dave Airlie <airlied@redhat.com>
6 * Copyright 2009 Hans Ulrich Niedermann <hun@n-dimensional.de>
5 * Copyright 2007-2009 Advanced Micro Devices, Inc. 7 * Copyright 2007-2009 Advanced Micro Devices, Inc.
6 * 8 *
7 * Permission is hereby granted, free of charge, to any person obtaining a 9 * Permission is hereby granted, free of charge, to any person obtaining a
@@ -88,6 +90,7 @@
88#define _XF86DRI_SERVER_ 90#define _XF86DRI_SERVER_
89#include "dri.h" 91#include "dri.h"
90#include "GL/glxint.h" 92#include "GL/glxint.h"
93#include "xf86drmMode.h"
91#endif 94#endif
92 95
93#if HAVE_XF86_ANSIC_H 96#if HAVE_XF86_ANSIC_H
@@ -398,6 +401,34 @@ RHDAvailableOptions(int chipid, int busid)
398 * 401 *
399 */ 402 */
400#ifdef XSERVER_LIBPCIACCESS 403#ifdef XSERVER_LIBPCIACCESS
404
405/* The radeon_kernel_mode_enabled() function is taken verbatim from
406 * radeon's radeon_probe.c file. */
407static Bool radeon_kernel_mode_enabled(ScrnInfoPtr pScrn, struct pci_device *pci_dev)
408{
409 char *busIdString;
410 int ret;
411
412 if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
413 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
414 "[KMS] No DRICreatePCIBusID symbol, no kernel modesetting.\n");
415 return FALSE;
416 }
417
418 busIdString = DRICreatePCIBusID(pci_dev);
419 ret = drmCheckModesettingSupported(busIdString);
420 xfree(busIdString);
421 if (ret) {
422 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
423 "[KMS] drm report modesetting isn't supported.\n");
424 return FALSE;
425 }
426
427 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
428 "[KMS] Kernel modesetting enabled.\n");
429 return TRUE;
430}
431
401static Bool 432static Bool
402RHDPciProbe(DriverPtr drv, int entityNum, 433RHDPciProbe(DriverPtr drv, int entityNum,
403 struct pci_device *dev, intptr_t matchData) 434 struct pci_device *dev, intptr_t matchData)
@@ -409,6 +440,21 @@ RHDPciProbe(DriverPtr drv, int entityNum,
409 RES_SHARED_VGA, NULL, NULL, NULL, NULL); 440 RES_SHARED_VGA, NULL, NULL, NULL, NULL);
410 if (pScrn != NULL) { 441 if (pScrn != NULL) {
411 442
443 if (dev) {
444 Bool kms = radeon_kernel_mode_enabled(pScrn, dev);
445 if (kms) {
446 xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 0,
447 "FATAL: RADEONHD does not work with kernel modesetting (KMS).\n"
448 "\tAppend \"nomodeset\" or \"radeon.modeset=0\" (depending\n"
449 "\ton your kernel version, or just add both to be sure) to \n"
450 "\tyour kernel command line in /boot/grub/grub.conf.\n");
451 return FALSE;
452 } else {
453 xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 0,
454 "KMS is disabled. This is good for us, because RADEONHD conflicts with KMS.\n");
455 }
456 }
457
412 pScrn->driverVersion = RHD_VERSION; 458 pScrn->driverVersion = RHD_VERSION;
413 pScrn->driverName = RHD_DRIVER_NAME; 459 pScrn->driverName = RHD_DRIVER_NAME;
414 pScrn->name = RHD_NAME; 460 pScrn->name = RHD_NAME;