diff options
author | Luca Barbieri <luca@luca-barbieri.com> | 2010-03-29 03:48:25 +0200 |
---|---|---|
committer | Luca Barbieri <luca@luca-barbieri.com> | 2010-03-29 03:48:25 +0200 |
commit | 3b5306bb925598c207f373ffa190bcb51f59a7e6 (patch) | |
tree | 56e70430f87a53fea7d41df6f62d59cf1e1cc1b2 | |
parent | 99f09528d95ca69ed4ae35e9fffa6f5ca7943682 (diff) |
add nv20-nv30 grctx table
-rw-r--r-- | nvlib.h | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -752,6 +752,15 @@ struct nv_device : public nv_region } }; + struct nv20_grctx_table : public nv_region + { + nv20_grctx_table(nv_ramin* ramin) + { + ptr = ramin->ptr + (ramin->dev->rd32(NV20_PGRAPH_CHANNEL_CTX_TABLE) << 4); + size = 4 * 32; + } + }; + struct pci_device* pci; uint64_t vram_phys; @@ -771,6 +780,7 @@ struct nv_device : public nv_region std::unique_ptr<nv_ramfc> ramfc; std::unique_ptr<nv_ramro> ramro; std::unique_ptr<nv_users> users; + std::unique_ptr<nv20_grctx_table> grctx_table; nv_device(const char* pciname) { @@ -866,6 +876,8 @@ struct nv_device : public nv_region ramro.reset(new nv_ramro(&*ramin)); users.reset(new nv_users(this)); + if(card_type == NV_20 || card_type == NV_30) + grctx_table.reset(new nv20_grctx_table(&*ramin)); init_grctx_info(); grctx_grclasses = -1; @@ -874,7 +886,6 @@ struct nv_device : public nv_region if(os->nv_driver == NV_DRIVER_NOUVEAU) grctx_grclasses = 0x40; } - } static nv_device* open_default() @@ -915,10 +926,13 @@ struct nv_device : public nv_region } uint32_t get_grctx(unsigned channel) { - if(ramfc->fc_grctx >= 0) + // TODO: nv50 is at "hdr" in channel-private RAMIN + if(ramfc->fc_grctx >= 0) /* NV40 */ return ramfc->fc[channel]->rd32(ramfc->fc_grctx) << 4; + else if(grctx_table) /* NV20-NV30 */ + return grctx_table->rd32(channel * 4) << 4; else - assert(0); + return 0; } void get_grclasses(unsigned channel, unsigned grclasses[8]) |