From 0ef29768ca909421539c3d8f65bb8e94912fa597 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 7 Sep 2006 23:59:19 +1000 Subject: [PATCH] Fix second start of X server without module reload beforehand, and a couple of other fixes. - Mark the correct RAMIN slots as free (oops) - Remove a VRAM alloc that shouldn't have been there (oops) - Move HT init out of firstopen() and into dma_init() - Setup PFIFO_RAM{HT,FC,RO} in pfifo_init() --- shared-core/nouveau_fifo.c | 7 +++++++ shared-core/nouveau_object.c | 10 +--------- shared-core/nouveau_state.c | 15 ++++++--------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/shared-core/nouveau_fifo.c b/shared-core/nouveau_fifo.c index 67ee6c7..ca7ddef 100644 --- a/shared-core/nouveau_fifo.c +++ b/shared-core/nouveau_fifo.c @@ -216,6 +216,13 @@ static void nouveau_pfifo_init(drm_device_t* dev) NV_WRITE(NV_PFIFO_CACH0_PUL0, 0x00000000); NV_WRITE(NV_PFIFO_SIZE , 0x0000FFFF); NV_WRITE(NV_PFIFO_CACH1_HASH, 0x0000FFFF); + NV_WRITE(NV_PFIFO_RAMHT, + (0x03 << 24) /* search 128 */ | + ((dev_priv->objs.ht_bits - 9) << 16) | + (dev_priv->objs.ht_base >> 8) + ); + NV_WRITE(NV_PFIFO_RAMFC, 0x00000110); /* RAMIN+0x11000 0.5k */ + NV_WRITE(NV_PFIFO_RAMRO, 0x00000112); /* RAMIN+0x11200 0.5k */ NV_WRITE(NV_PFIFO_CACH0_PUL1, 0x00000001); NV_WRITE(NV_PFIFO_CACH1_DMAC, 0x00000000); NV_WRITE(NV_PFIFO_CACH1_ENG, 0x00000000); diff --git a/shared-core/nouveau_object.c b/shared-core/nouveau_object.c index f5c16c5..a7fe06c 100644 --- a/shared-core/nouveau_object.c +++ b/shared-core/nouveau_object.c @@ -241,7 +241,7 @@ static void nouveau_object_instance_free(drm_device_t *dev, obj->instance >>= (dev_priv->card_type >=NV_40 ? 5 : 4); be = obj->instance / 32; bb = obj->instance % 32; - objs->inst_bmap[be] &= ~bb; + objs->inst_bmap[be] &= ~(1<free_instance++; } @@ -265,14 +265,6 @@ void nouveau_hash_table_init(drm_device_t* dev) dev_priv->objs.ht_base = 0x10000; dev_priv->objs.ht_size = (1 << dev_priv->objs.ht_bits); - NV_WRITE(NV_PFIFO_RAMHT, - (0x03 << 24) /* search 128 */ | - ((dev_priv->objs.ht_bits - 9) << 16) | - ((dev_priv->objs.ht_base >> 16) << 4) - ); - NV_WRITE(NV_PFIFO_RAMFC, 0x00000110); /* RAMIN+0x11000 0.5k */ - NV_WRITE(NV_PFIFO_RAMRO, 0x00000112); /* RAMIN+0x11200 0.5k */ - dev_priv->objs.first_instance = 0x12000; dev_priv->objs.free_instance = 1024; /*FIXME*/ dev_priv->objs.num_instance = 1024; /*FIXME*/ diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c index 707d42e..6c5cc15 100644 --- a/shared-core/nouveau_state.c +++ b/shared-core/nouveau_state.c @@ -69,13 +69,6 @@ int nouveau_firstopen(struct drm_device *dev) else dev_priv->fb_usable_size=nouveau_mem_fb_amount(dev)-256*1024; - nouveau_hash_table_init(dev); - - if (dev_priv->card_type >= NV_40) - dev_priv->fb_obj = nouveau_dma_object_create(dev, - 0, nouveau_mem_fb_amount(dev), - NV_DMA_ACCESS_RW, NV_DMA_TARGET_VIDMEM); - return 0; } @@ -164,8 +157,12 @@ int nouveau_dma_init(struct drm_device *dev) struct mem_block *cb; int cb_min_size = nouveau_fifo_number(dev) * NV03_FIFO_SIZE; - /* allocate one buffer for all the fifos */ - dev_priv->cmdbuf_alloc = nouveau_mem_alloc(dev, 0, 1024*1024, NOUVEAU_MEM_FB, (DRMFILE)-2); + nouveau_hash_table_init(dev); + + if (dev_priv->card_type >= NV_40) + dev_priv->fb_obj = nouveau_dma_object_create(dev, + 0, nouveau_mem_fb_amount(dev), + NV_DMA_ACCESS_RW, NV_DMA_TARGET_VIDMEM); /* Defaults for unconfigured values */ if (!config->cmdbuf.location) -- 2.7.4