[PATCH] Bail if we're trying to start up in UMS mode on KMS.
Michel Dänzer
michel at daenzer.net
Wed Aug 17 02:47:57 PDT 2011
From: Michel Dänzer <michel.daenzer at amd.com>
Ideally, the display manager will start the X server again, and everything
will be fine and dandy. But in the worst case, at least we won't hit the
hardware behind the KMS driver's back.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/radeon.h | 2 +-
src/radeon_dri.c | 29 ++++++++++++++++++++++-------
src/radeon_driver.c | 8 ++++++--
3 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/src/radeon.h b/src/radeon.h
index f66ffd0..151d85a 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1240,7 +1240,7 @@ extern void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen);
extern void RADEONDRICloseScreen(ScreenPtr pScreen);
extern Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen);
extern int RADEONDRIGetPciAperTableSize(ScrnInfoPtr pScrn);
-extern Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn);
+extern int RADEONDRIGetVersion(ScrnInfoPtr pScrn);
extern void RADEONDRIResume(ScreenPtr pScreen);
extern Bool RADEONDRIScreenInit(ScreenPtr pScreen);
extern int RADEONDRISetParam(ScrnInfoPtr pScrn,
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index ed167ed..946b4dc 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -1336,7 +1336,7 @@ static void RADEONDRICPInit(ScrnInfoPtr pScrn)
/* Get the DRM version and do some basic useability checks of DRI */
-Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn)
+int RADEONDRIGetVersion(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
int major, minor, patch, fd;
@@ -1452,8 +1452,26 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn)
}
/* We don't, bummer ! */
- if (info->dri->pKernelDRMVersion->version_major != req_major ||
- info->dri->pKernelDRMVersion->version_minor < req_minor ||
+ if (info->dri->pKernelDRMVersion->version_major != req_major) {
+ /* Looks like we're trying to start in UMS mode on a KMS kernel.
+ * This can happen if the radeon kernel module wasn't loaded before
+ * X starts.
+ */
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "[dri] RADEONDRIGetVersion failed because of a version mismatch.\n"
+ "[dri] This chipset requires a kernel module version of %d.%d.%d,\n"
+ "[dri] but the kernel reports a version of %d.%d.%d."
+ "[dri] Make sure your module is loaded prior to starting X, and\n"
+ "[dri] that this driver was built with support for KMS.\n"
+ "[dri] Aborting.\n",
+ req_major, req_minor, req_patch,
+ info->dri->pKernelDRMVersion->version_major,
+ info->dri->pKernelDRMVersion->version_minor,
+ info->dri->pKernelDRMVersion->version_patchlevel);
+ drmFreeVersion(info->dri->pKernelDRMVersion);
+ info->dri->pKernelDRMVersion = NULL;
+ return -1;
+ } else if (info->dri->pKernelDRMVersion->version_minor < req_minor ||
(info->dri->pKernelDRMVersion->version_minor == req_minor &&
info->dri->pKernelDRMVersion->version_patchlevel < req_patch)) {
/* Incompatible drm version */
@@ -1461,10 +1479,7 @@ Bool RADEONDRIGetVersion(ScrnInfoPtr pScrn)
"[dri] RADEONDRIGetVersion failed because of a version mismatch.\n"
"[dri] This chipset requires a kernel module version of %d.%d.%d,\n"
"[dri] but the kernel reports a version of %d.%d.%d."
- "[dri] If using legacy modesetting, upgrade your kernel.\n"
- "[dri] If using kernel modesetting, make sure your module is\n"
- "[dri] loaded prior to starting X, and that this driver was built\n"
- "[dri] with support for KMS.\n"
+ "[dri] Try upgrading your kernel.\n"
"[dri] Disabling DRI.\n",
req_major, req_minor, req_patch,
info->dri->pKernelDRMVersion->version_major,
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 202951f..1a5b334 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2333,7 +2333,7 @@ static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10)
}
#ifdef XF86DRI
-static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn)
+static int RADEONPreInitDRI(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
MessageType from;
@@ -2402,7 +2402,9 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn)
info->dri->pLibDRMVersion = NULL;
info->dri->pKernelDRMVersion = NULL;
- if (!RADEONDRIGetVersion(pScrn))
+ if (RADEONDRIGetVersion(pScrn) < 0)
+ return -1;
+ else if (!RADEONDRIGetVersion(pScrn))
return FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -3166,6 +3168,8 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
* memory map
*/
info->directRenderingEnabled = RADEONPreInitDRI(pScrn);
+ if (info->directRenderingEnabled < 0)
+ goto fail;
#endif
if (!info->directRenderingEnabled) {
if (info->ChipFamily >= CHIP_FAMILY_R600) {
--
1.7.5.4
More information about the xorg-driver-ati
mailing list