summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-03-29 04:47:51 +0200
committerLuca Barbieri <luca@luca-barbieri.com>2010-03-29 04:47:51 +0200
commitacf2c8d3d6faac836ccb61516f4afa38f1e835c2 (patch)
treee4a814d523817d70a98e491539e15082e04a3958
parent3b5306bb925598c207f373ffa190bcb51f59a7e6 (diff)
work
-rw-r--r--nvlib.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/nvlib.h b/nvlib.h
index 6777d90..17bf300 100644
--- a/nvlib.h
+++ b/nvlib.h
@@ -886,6 +886,8 @@ struct nv_device : public nv_region
if(os->nv_driver == NV_DRIVER_NOUVEAU)
grctx_grclasses = 0x40;
}
+ else if(card_type == NV_30)
+ grctx_grclasses = 0x40;
}
static nv_device* open_default()
@@ -935,18 +937,20 @@ struct nv_device : public nv_region
return 0;
}
- void get_grclasses(unsigned channel, unsigned grclasses[8])
+ bool get_grclasses(unsigned channel, unsigned grclasses[8])
{
if(os->nv_driver == NV_DRIVER_NVIDIA) {
memcpy(grclasses, nvidia_grclasses + 8 * card_type, 8 * sizeof(unsigned));
} else {
- /* TODO: do this for non-nv40 */
- assert(ramfc->fc_grctx >= 0 && grctx_grclasses >= 0);
-
- uint32_t grctx = ramfc->fc[channel]->rd32(ramfc->fc_grctx) << 4;
+ if(!grctx_grclasses)
+ return false;
+ uint32_t grctx = get_grctx(channel);
+ if(!grctx)
+ return false;
for(unsigned i = 0; i < 8; ++i)
grclasses[i] = ramin->rd32(grctx + grctx_grclasses + i * 4) & 0xffff;
}
+ return true;
}