summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/nouveau_drv.h2
-rw-r--r--shared-core/nouveau_fifo.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/shared-core/nouveau_drv.h b/shared-core/nouveau_drv.h
index f579026a..ac21f654 100644
--- a/shared-core/nouveau_drv.h
+++ b/shared-core/nouveau_drv.h
@@ -112,6 +112,7 @@ typedef struct drm_nouveau_private {
drm_local_map_t *mmio;
drm_local_map_t *fb;
+ //TODO: Remove me, I'm bogus :)
int cur_fifo;
struct nouveau_object *fb_obj;
@@ -119,6 +120,7 @@ typedef struct drm_nouveau_private {
int cmdbuf_ch_size;
struct mem_block* cmdbuf_alloc;
+ int fifo_alloc_count;
struct nouveau_fifo fifos[NV_MAX_FIFO_NUMBER];
struct nouveau_object_store objs;
/* RAMFC and RAMRO offsets */
diff --git a/shared-core/nouveau_fifo.c b/shared-core/nouveau_fifo.c
index cf389647..ef63f084 100644
--- a/shared-core/nouveau_fifo.c
+++ b/shared-core/nouveau_fifo.c
@@ -178,7 +178,6 @@ static int nouveau_dma_init(struct drm_device *dev)
dev_priv->cmdbuf_ch_size = (uint32_t)cb->size / nouveau_fifo_number(dev);
dev_priv->cmdbuf_alloc = cb;
- nouveau_fifo_init(dev);
DRM_INFO("DMA command buffer is %dKiB at 0x%08x(%s)\n",
(uint32_t)cb->size>>10, (uint32_t)cb->start,
config->cmdbuf.location == NOUVEAU_MEM_FB ? "VRAM" : "AGP");
@@ -306,6 +305,9 @@ static int nouveau_fifo_alloc(drm_device_t* dev,drm_nouveau_fifo_alloc_t* init,
if (ret)
return ret;
}
+ /* Initialise PFIFO regs */
+ if (!dev_priv->fifo_alloc_count)
+ nouveau_fifo_init(dev);
/*
* Alright, here is the full story
@@ -409,6 +411,7 @@ static int nouveau_fifo_alloc(drm_device_t* dev,drm_nouveau_fifo_alloc_t* init,
/* FIFO has no objects yet */
dev_priv->fifos[init->channel].objs = NULL;
+ dev_priv->fifo_alloc_count++;
DRM_INFO("%s: initialised FIFO %d\n", __func__, init->channel);
return 0;
@@ -438,6 +441,8 @@ void nouveau_fifo_free(drm_device_t* dev,int n)
/* reenable the fifo caches */
NV_WRITE(NV_PFIFO_CACHES, 0x00000001);
+
+ dev_priv->fifo_alloc_count--;
}
/* cleanups all the fifos from filp */