summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-03-23 21:56:31 -0500
committerDave Airlie <airlied@redhat.com>2010-03-24 13:16:10 +1000
commit8064d2a18110efc15dbabf052d5ebcb260437b88 (patch)
tree11fece075834b6d1bb7adeb5839942e25a10a58c
parent533aae6a8cfed34a1554c244151d1a781eec0c3e (diff)
radeontool: Avoid lockup on ‘radeontool regmatch '*'’ on r128
Running ‘radeontool regmatch '*'’ with an ATI Rage 128 Mobility M3 LF (AGP) locks up the system. The register reads that lock up are CRTC2_CRNT_FRAME and CRTC2_VLINE_CRNT_VLINE; it is not clear to me why. From the xf86-video-r128 source I can see that this is one of the handful of r128 chips that supports dual-head operation, but at the time of the lockup, the CRTC2_GEN_CNTL register had value 0x0 (i.e., CRTC2 disabled); maybe that’s why. Presumably these two registers would only be relevant if CRTC2 is enabled, so as a safety measure, check for that before displaying them with ‘radeontool regmatch [pattern]’. A similar crash was reported on 2009-12-02 on #radeon for an R300, so presumably this problem is not restricted to pre-Radeon cards. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--radeontool.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/radeontool.c b/radeontool.c
index d4968e5..520a8af 100644
--- a/radeontool.c
+++ b/radeontool.c
@@ -732,11 +732,23 @@ void radeon_reg_match(const char *pattern)
printf("%s\t0x%08x (%d)\n", pattern, value, value);
}
else {
+ int crtc2_enabled;
+
/* Prepare for a crash (just in case). */
sync();
+ /* dual-head setup? */
+ value = radeon_get(RADEON_CRTC2_GEN_CNTL, "RADEON_CRTC2_GEN_CTRL");
+ crtc2_enabled = (value & RADEON_CRTC2_EN) ? 1 : 0;
+
for (i = 0; i < sizeof(reg_list) / sizeof(reg_list[0]); i++) {
if (fnmatch(pattern, reg_list[i].name, 0) == 0) {
+ if (!crtc2_enabled &&
+ (reg_list[i].address == RADEON_CRTC2_CRNT_FRAME ||
+ reg_list[i].address == RADEON_CRTC2_VLINE_CRNT_VLINE))
+ /* might freeze, so skip it */
+ continue;
+
printf("%s (%s%04x)\t", reg_list[i].name,
reg_list[i].type, reg_list[i].address);