summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2011-08-17 11:10:34 +0200
committerMichel Dänzer <michel@daenzer.net>2011-08-17 11:10:34 +0200
commit95991fcce45f0dd904f76b9f98f9c7ed5708e4fa (patch)
tree618f98dfa03968a455a53bb5c3cf3d1ebab6c064
parentf95a41b7851565c282d22f8d679db1377428f165 (diff)
Bail if we're trying to start up in UMS mode on KMS.
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. (This change intentionally makes (ab)use of the fact that Bool is defined as int). Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/radeon_dri.c27
-rw-r--r--src/radeon_driver.c8
2 files changed, 27 insertions, 8 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index ed167ed0..07f127c0 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -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 202951fd..293897a9 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2336,6 +2336,7 @@ static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10)
static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
+ Bool ret;
MessageType from;
char *reason;
@@ -2402,8 +2403,9 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn)
info->dri->pLibDRMVersion = NULL;
info->dri->pKernelDRMVersion = NULL;
- if (!RADEONDRIGetVersion(pScrn))
- return FALSE;
+ ret = RADEONDRIGetVersion(pScrn);
+ if (ret <= 0)
+ return ret;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[dri] Found DRI library version %d.%d.%d and kernel"
@@ -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) {