summaryrefslogtreecommitdiff
path: root/linux-core/drm_ttm.c
diff options
context:
space:
mode:
authorJesse Barnes <jesse.barnes@intel.com>2007-10-30 12:52:46 -0700
committerJesse Barnes <jesse.barnes@intel.com>2007-10-30 12:52:46 -0700
commit91aae7e683786a48547872b0a5fa92b2232e02c0 (patch)
treea30c8022886d61add4a4c2e073fa07f29d7745a7 /linux-core/drm_ttm.c
parent7e9ea55a2f052cc939ba9bbf9edac39798344b7a (diff)
parent79744d730c90019edd367eee4a8ec1fa22d53402 (diff)
Merge branch 'master' into vblank-rework, fixup remaining drivers
Conflicts: linux-core/drmP.h linux-core/drm_drv.c linux-core/drm_irq.c shared-core/i915_drv.h shared-core/i915_irq.c shared-core/mga_drv.h shared-core/mga_irq.c shared-core/radeon_drv.h shared-core/radeon_irq.c Merge in the latest master bits and update the remaining drivers (except mach64 which math_b is working on). Also remove the 9xx hack from the i915 driver; it seems to be correct.
Diffstat (limited to 'linux-core/drm_ttm.c')
-rw-r--r--linux-core/drm_ttm.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index 31503c9c..df9e7e44 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -35,17 +35,18 @@ static void drm_ttm_ipi_handler(void *null)
flush_agp_cache();
}
-static void drm_ttm_cache_flush(void)
+void drm_ttm_cache_flush(void)
{
if (on_each_cpu(drm_ttm_ipi_handler, NULL, 1, 1) != 0)
DRM_ERROR("Timed out waiting for drm cache flush.\n");
}
+EXPORT_SYMBOL(drm_ttm_cache_flush);
/*
* Use kmalloc if possible. Otherwise fall back to vmalloc.
*/
-static void ttm_alloc_pages(drm_ttm_t * ttm)
+static void ttm_alloc_pages(struct drm_ttm * ttm)
{
unsigned long size = ttm->num_pages * sizeof(*ttm->pages);
ttm->pages = NULL;
@@ -66,7 +67,7 @@ static void ttm_alloc_pages(drm_ttm_t * ttm)
}
}
-static void ttm_free_pages(drm_ttm_t * ttm)
+static void ttm_free_pages(struct drm_ttm * ttm)
{
unsigned long size = ttm->num_pages * sizeof(*ttm->pages);
@@ -105,7 +106,7 @@ static struct page *drm_ttm_alloc_page(void)
* for range of pages in a ttm.
*/
-static int drm_set_caching(drm_ttm_t * ttm, int noncached)
+static int drm_set_caching(struct drm_ttm * ttm, int noncached)
{
int i;
struct page **cur_page;
@@ -142,12 +143,12 @@ static int drm_set_caching(drm_ttm_t * ttm, int noncached)
* Free all resources associated with a ttm.
*/
-int drm_destroy_ttm(drm_ttm_t * ttm)
+int drm_destroy_ttm(struct drm_ttm * ttm)
{
int i;
struct page **cur_page;
- drm_ttm_backend_t *be;
+ struct drm_ttm_backend *be;
if (!ttm)
return 0;
@@ -159,7 +160,7 @@ int drm_destroy_ttm(drm_ttm_t * ttm)
}
if (ttm->pages) {
- drm_buffer_manager_t *bm = &ttm->dev->bm;
+ struct drm_buffer_manager *bm = &ttm->dev->bm;
if (ttm->page_flags & DRM_TTM_PAGE_UNCACHED)
drm_set_caching(ttm, 0);
@@ -191,10 +192,10 @@ int drm_destroy_ttm(drm_ttm_t * ttm)
return 0;
}
-struct page *drm_ttm_get_page(drm_ttm_t * ttm, int index)
+struct page *drm_ttm_get_page(struct drm_ttm * ttm, int index)
{
struct page *p;
- drm_buffer_manager_t *bm = &ttm->dev->bm;
+ struct drm_buffer_manager *bm = &ttm->dev->bm;
p = ttm->pages[index];
if (!p) {
@@ -206,12 +207,13 @@ struct page *drm_ttm_get_page(drm_ttm_t * ttm, int index)
}
return p;
}
+EXPORT_SYMBOL(drm_ttm_get_page);
-static int drm_ttm_populate(drm_ttm_t * ttm)
+int drm_ttm_populate(struct drm_ttm * ttm)
{
struct page *page;
unsigned long i;
- drm_ttm_backend_t *be;
+ struct drm_ttm_backend *be;
if (ttm->state != ttm_unpopulated)
return 0;
@@ -231,10 +233,10 @@ static int drm_ttm_populate(drm_ttm_t * ttm)
* Initialize a ttm.
*/
-drm_ttm_t *drm_ttm_init(struct drm_device * dev, unsigned long size)
+struct drm_ttm *drm_ttm_init(struct drm_device * dev, unsigned long size)
{
- drm_bo_driver_t *bo_driver = dev->driver->bo_driver;
- drm_ttm_t *ttm;
+ struct drm_bo_driver *bo_driver = dev->driver->bo_driver;
+ struct drm_ttm *ttm;
if (!bo_driver)
return NULL;
@@ -275,9 +277,9 @@ drm_ttm_t *drm_ttm_init(struct drm_device * dev, unsigned long size)
* Unbind a ttm region from the aperture.
*/
-void drm_ttm_evict(drm_ttm_t * ttm)
+void drm_ttm_evict(struct drm_ttm * ttm)
{
- drm_ttm_backend_t *be = ttm->be;
+ struct drm_ttm_backend *be = ttm->be;
int ret;
if (ttm->state == ttm_bound) {
@@ -288,11 +290,11 @@ void drm_ttm_evict(drm_ttm_t * ttm)
ttm->state = ttm_evicted;
}
-void drm_ttm_fixup_caching(drm_ttm_t * ttm)
+void drm_ttm_fixup_caching(struct drm_ttm * ttm)
{
if (ttm->state == ttm_evicted) {
- drm_ttm_backend_t *be = ttm->be;
+ struct drm_ttm_backend *be = ttm->be;
if (be->func->needs_ub_cache_adjust(be)) {
drm_set_caching(ttm, 0);
}
@@ -300,7 +302,7 @@ void drm_ttm_fixup_caching(drm_ttm_t * ttm)
}
}
-void drm_ttm_unbind(drm_ttm_t * ttm)
+void drm_ttm_unbind(struct drm_ttm * ttm)
{
if (ttm->state == ttm_bound)
drm_ttm_evict(ttm);
@@ -308,11 +310,11 @@ void drm_ttm_unbind(drm_ttm_t * ttm)
drm_ttm_fixup_caching(ttm);
}
-int drm_bind_ttm(drm_ttm_t * ttm, int cached, unsigned long aper_offset)
+int drm_bind_ttm(struct drm_ttm * ttm, struct drm_bo_mem_reg *bo_mem)
{
-
+ struct drm_bo_driver *bo_driver = ttm->dev->driver->bo_driver;
int ret = 0;
- drm_ttm_backend_t *be;
+ struct drm_ttm_backend *be;
if (!ttm)
return -EINVAL;
@@ -325,17 +327,18 @@ int drm_bind_ttm(drm_ttm_t * ttm, int cached, unsigned long aper_offset)
if (ret)
return ret;
- if (ttm->state == ttm_unbound && !cached) {
+ if (ttm->state == ttm_unbound && !(bo_mem->flags & DRM_BO_FLAG_CACHED)) {
drm_set_caching(ttm, DRM_TTM_PAGE_UNCACHED);
- }
+ } else if ((bo_mem->flags & DRM_BO_FLAG_CACHED) &&
+ bo_driver->ttm_cache_flush)
+ bo_driver->ttm_cache_flush(ttm);
- if ((ret = be->func->bind(be, aper_offset, cached))) {
+ if ((ret = be->func->bind(be, bo_mem))) {
ttm->state = ttm_evicted;
DRM_ERROR("Couldn't bind backend.\n");
return ret;
}
- ttm->aper_offset = aper_offset;
ttm->state = ttm_bound;
return 0;