summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-03-23 21:54:29 -0500
committerDave Airlie <airlied@redhat.com>2010-03-24 13:16:08 +1000
commit51a87cf04e1aaca1efd938dcf37ba973f1d27350 (patch)
treeb651983423a5525c08248b8a32a4915d763bb2da
parentf25e9a743221a0c4fe7d45fe50bb50712ce46334 (diff)
radeontool: error out for too many control or fb regions
With the previous commit (radeontool: handle r128 again, 2010-03-23), the rules for finding the control area and framebuffer became more lax. It is possible that some cards have multiple regions satisfying the new criteria, in which case the code makes a silly arbitrary choice. Better to error out and make it clear what happened in such a case. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--radeontool.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/radeontool.c b/radeontool.c
index 7cfd8e4..10b9266 100644
--- a/radeontool.c
+++ b/radeontool.c
@@ -915,10 +915,15 @@ static void map_radeon_cntl_mem(void)
}
for (i = 0; i < 6; i++) {
if (device->regions[i].size >= 16 * 1024 &&
- device->regions[i].size <= 64 * 1024)
+ device->regions[i].size <= 64 * 1024) {
+ if (ctrl_region != -1)
+ fatal("cannot distinguish ctrl region\n");
ctrl_region = i;
- else if (device->regions[i].size >= 64 * 1024 * 1024)
+ } else if (device->regions[i].size >= 64 * 1024 * 1024) {
+ if (fb_region != -1)
+ fatal("cannot distinguish fb region\n");
fb_region = i;
+ }
}
if (ctrl_region == -1)
fatal("cannot find ctrl region\n");