summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/Makefile.kernel3
-rw-r--r--linux-core/drm_sman.c1
-rw-r--r--linux-core/drm_ttm.c39
-rw-r--r--linux-core/drm_ttm.h1
-rw-r--r--linux-core/nouveau_drv.c2
l---------linux-core/nv10_graph.c1
l---------linux-core/nv20_graph.c1
l---------linux-core/nv30_graph.c1
8 files changed, 28 insertions, 21 deletions
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index b4ac2642..b531a70f 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -22,7 +22,8 @@ i830-objs := i830_drv.o i830_dma.o i830_irq.o
i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o \
i915_buffer.o
nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
- nouveau_object.o nouveau_irq.o nv40_graph.o
+ nouveau_object.o nouveau_irq.o nv10_graph.o nv30_graph.o nv40_graph.o \
+ nv20_graph.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
sis-objs := sis_drv.o sis_mm.o
ffb-objs := ffb_drv.o ffb_context.o
diff --git a/linux-core/drm_sman.c b/linux-core/drm_sman.c
index 19a13f3a..e15db6d6 100644
--- a/linux-core/drm_sman.c
+++ b/linux-core/drm_sman.c
@@ -161,6 +161,7 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
return 0;
}
+EXPORT_SYMBOL(drm_sman_set_manager);
static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman,
unsigned long owner)
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index 1c9b1cf7..c17c41cb 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -44,34 +44,39 @@ static void drm_ttm_cache_flush(void)
* Use kmalloc if possible. Otherwise fall back to vmalloc.
*/
-static void *ttm_alloc(unsigned long size, int type)
+static void ttm_alloc_pages(drm_ttm_t *ttm)
{
- void *ret = NULL;
+ unsigned long size = ttm->num_pages * sizeof(*ttm->pages);
+ ttm->pages = NULL;
if (drm_alloc_memctl(size))
- return NULL;
+ return;
+
if (size <= PAGE_SIZE) {
- ret = drm_alloc(size, type);
+ ttm->pages = drm_calloc(1, size, DRM_MEM_TTM);
}
- if (!ret) {
- ret = vmalloc(size);
+ if (!ttm->pages) {
+ ttm->pages = vmalloc_user(size);
+ if (ttm->pages)
+ ttm->page_flags |= DRM_TTM_PAGE_VMALLOC;
}
- if (!ret) {
+ if (!ttm->pages) {
drm_free_memctl(size);
}
- return ret;
}
-static void ttm_free(void *pointer, unsigned long size, int type)
+static void ttm_free_pages(drm_ttm_t *ttm)
{
+ unsigned long size = ttm->num_pages * sizeof(*ttm->pages);
- if ((unsigned long)pointer >= VMALLOC_START &&
- (unsigned long)pointer <= VMALLOC_END) {
- vfree(pointer);
+ if (ttm->page_flags & DRM_TTM_PAGE_VMALLOC) {
+ vfree(ttm->pages);
+ ttm->page_flags &= ~DRM_TTM_PAGE_VMALLOC;
} else {
- drm_free(pointer, size, type);
+ drm_free(ttm->pages, size, DRM_MEM_TTM);
}
drm_free_memctl(size);
+ ttm->pages = NULL;
}
/*
@@ -198,9 +203,7 @@ int drm_destroy_ttm(drm_ttm_t * ttm)
--bm->cur_pages;
}
}
- ttm_free(ttm->pages, ttm->num_pages * sizeof(*ttm->pages),
- DRM_MEM_TTM);
- ttm->pages = NULL;
+ ttm_free_pages(ttm);
}
drm_ctl_free(ttm, sizeof(*ttm), DRM_MEM_TTM);
@@ -277,14 +280,12 @@ static drm_ttm_t *drm_init_ttm(struct drm_device *dev, unsigned long size)
* Account also for AGP module memory usage.
*/
- ttm->pages = ttm_alloc(ttm->num_pages * sizeof(*ttm->pages),
- DRM_MEM_TTM);
+ ttm_alloc_pages(ttm);
if (!ttm->pages) {
drm_destroy_ttm(ttm);
DRM_ERROR("Failed allocating page table\n");
return NULL;
}
- memset(ttm->pages, 0, ttm->num_pages * sizeof(*ttm->pages));
ttm->be = bo_driver->create_ttm_backend_entry(dev);
if (!ttm->be) {
drm_destroy_ttm(ttm);
diff --git a/linux-core/drm_ttm.h b/linux-core/drm_ttm.h
index 11a13754..796f2317 100644
--- a/linux-core/drm_ttm.h
+++ b/linux-core/drm_ttm.h
@@ -141,5 +141,6 @@ static __inline__ drm_ttm_t *drm_ttm_from_object(drm_ttm_object_t * to)
#define DRM_TTM_PAGE_USED 0x02
#define DRM_TTM_PAGE_BOUND 0x04
#define DRM_TTM_PAGE_PRESENT 0x08
+#define DRM_TTM_PAGE_VMALLOC 0x10
#endif
diff --git a/linux-core/nouveau_drv.c b/linux-core/nouveau_drv.c
index 91de2b31..ac030d89 100644
--- a/linux-core/nouveau_drv.c
+++ b/linux-core/nouveau_drv.c
@@ -38,7 +38,7 @@ extern int nouveau_max_ioctl;
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
+ DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
.load = nouveau_load,
.firstopen = nouveau_firstopen,
diff --git a/linux-core/nv10_graph.c b/linux-core/nv10_graph.c
new file mode 120000
index 00000000..0d5a0eb4
--- /dev/null
+++ b/linux-core/nv10_graph.c
@@ -0,0 +1 @@
+../shared-core/nv10_graph.c \ No newline at end of file
diff --git a/linux-core/nv20_graph.c b/linux-core/nv20_graph.c
new file mode 120000
index 00000000..73049914
--- /dev/null
+++ b/linux-core/nv20_graph.c
@@ -0,0 +1 @@
+../shared-core/nv20_graph.c \ No newline at end of file
diff --git a/linux-core/nv30_graph.c b/linux-core/nv30_graph.c
new file mode 120000
index 00000000..25568ecb
--- /dev/null
+++ b/linux-core/nv30_graph.c
@@ -0,0 +1 @@
+../shared-core/nv30_graph.c \ No newline at end of file