[PATCH 4/7] radeontool: error out for too many control or fb regions

Jonathan Nieder jrnieder at gmail.com
Tue Mar 23 19:54:29 PDT 2010


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 at gmail.com>
---
It might make sense to make the requirements for the control area
and framebuffer stricter, too.

Tormod Volden wrote:

> I don't know how many cards and configurations are possible, maybe an
> interval like 16-64 could be used? I also thought about adding a check
> for the is_prefetchable (and !is_IO) flag which AFAICS seems to be on
> for the control regions. However the flag was not set when I tried to
> read it out with libpciaccess even though lspci indicates it. I don't
> know if this is a bug in libpciaccess or if I tried to use it the
> wrong way.

Any insights?

 radeontool.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/radeontool.c b/radeontool.c
index 019f0ce..1351c70 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");
-- 
1.7.0.3



More information about the xorg-driver-ati mailing list