aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_agpsupport.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/drm_agpsupport.c')
-rw-r--r--linux-core/drm_agpsupport.c171
1 files changed, 0 insertions, 171 deletions
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 2abfac6e..9f746a32 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -498,177 +498,6 @@ drm_agp_bind_pages(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_agp_bind_pages);
-/*
- * AGP ttm backend interface.
- */
-
-#ifndef AGP_USER_TYPES
-#define AGP_USER_TYPES (1 << 16)
-#define AGP_USER_MEMORY (AGP_USER_TYPES)
-#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
-#endif
-#define AGP_REQUIRED_MAJOR 0
-#define AGP_REQUIRED_MINOR 102
-
-static int drm_agp_needs_unbind_cache_adjust(struct drm_ttm_backend *backend)
-{
- return ((backend->flags & DRM_BE_FLAG_BOUND_CACHED) ? 0 : 1);
-}
-
-
-static int drm_agp_populate(struct drm_ttm_backend *backend,
- unsigned long num_pages, struct page **pages,
- struct page *dummy_read_page)
-{
- struct drm_agp_ttm_backend *agp_be =
- container_of(backend, struct drm_agp_ttm_backend, backend);
- struct page **cur_page, **last_page = pages + num_pages;
- DRM_AGP_MEM *mem;
- int dummy_page_count = 0;
-
- if (drm_alloc_memctl(num_pages * sizeof(void *)))
- return -1;
-
- DRM_DEBUG("drm_agp_populate_ttm\n");
- mem = drm_agp_allocate_memory(agp_be->bridge, num_pages, AGP_USER_MEMORY);
- if (!mem) {
- drm_free_memctl(num_pages * sizeof(void *));
- return -1;
- }
-
- DRM_DEBUG("Current page count is %ld\n", (long) mem->page_count);
- mem->page_count = 0;
- for (cur_page = pages; cur_page < last_page; ++cur_page) {
- struct page *page = *cur_page;
- if (!page) {
- page = dummy_read_page;
- ++dummy_page_count;
- }
- mem->memory[mem->page_count++] = phys_to_gart(page_to_phys(page));
- }
- if (dummy_page_count)
- DRM_DEBUG("Mapped %d dummy pages\n", dummy_page_count);
- agp_be->mem = mem;
- return 0;
-}
-
-static int drm_agp_bind_ttm(struct drm_ttm_backend *backend,
- struct drm_bo_mem_reg *bo_mem)
-{
- struct drm_agp_ttm_backend *agp_be =
- container_of(backend, struct drm_agp_ttm_backend, backend);
- DRM_AGP_MEM *mem = agp_be->mem;
- int ret;
- int snooped = (bo_mem->flags & DRM_BO_FLAG_CACHED) && !(bo_mem->flags & DRM_BO_FLAG_CACHED_MAPPED);
-
- DRM_DEBUG("drm_agp_bind_ttm\n");
- mem->is_flushed = true;
- mem->type = AGP_USER_MEMORY;
- /* CACHED MAPPED implies not snooped memory */
- if (snooped)
- mem->type = AGP_USER_CACHED_MEMORY;
-
- ret = drm_agp_bind_memory(mem, bo_mem->mm_node->start);
- if (ret)
- DRM_ERROR("AGP Bind memory failed\n");
-
- DRM_FLAG_MASKED(backend->flags, (bo_mem->flags & DRM_BO_FLAG_CACHED) ?
- DRM_BE_FLAG_BOUND_CACHED : 0,
- DRM_BE_FLAG_BOUND_CACHED);
- return ret;
-}
-
-static int drm_agp_unbind_ttm(struct drm_ttm_backend *backend)
-{
- struct drm_agp_ttm_backend *agp_be =
- container_of(backend, struct drm_agp_ttm_backend, backend);
-
- DRM_DEBUG("drm_agp_unbind_ttm\n");
- if (agp_be->mem->is_bound)
- return drm_agp_unbind_memory(agp_be->mem);
- else
- return 0;
-}
-
-static void drm_agp_clear_ttm(struct drm_ttm_backend *backend)
-{
- struct drm_agp_ttm_backend *agp_be =
- container_of(backend, struct drm_agp_ttm_backend, backend);
- DRM_AGP_MEM *mem = agp_be->mem;
-
- DRM_DEBUG("drm_agp_clear_ttm\n");
- if (mem) {
- unsigned long num_pages = mem->page_count;
- backend->func->unbind(backend);
- agp_free_memory(mem);
- drm_free_memctl(num_pages * sizeof(void *));
- }
- agp_be->mem = NULL;
-}
-
-static void drm_agp_destroy_ttm(struct drm_ttm_backend *backend)
-{
- struct drm_agp_ttm_backend *agp_be;
-
- if (backend) {
- DRM_DEBUG("drm_agp_destroy_ttm\n");
- agp_be = container_of(backend, struct drm_agp_ttm_backend, backend);
- if (agp_be) {
- if (agp_be->mem)
- backend->func->clear(backend);
- drm_ctl_free(agp_be, sizeof(*agp_be), DRM_MEM_TTM);
- }
- }
-}
-
-static struct drm_ttm_backend_func agp_ttm_backend = {
- .needs_ub_cache_adjust = drm_agp_needs_unbind_cache_adjust,
- .populate = drm_agp_populate,
- .clear = drm_agp_clear_ttm,
- .bind = drm_agp_bind_ttm,
- .unbind = drm_agp_unbind_ttm,
- .destroy = drm_agp_destroy_ttm,
-};
-
-struct drm_ttm_backend *drm_agp_init_ttm(struct drm_device *dev)
-{
-
- struct drm_agp_ttm_backend *agp_be;
- struct agp_kern_info *info;
-
- if (!dev->agp) {
- DRM_ERROR("AGP is not initialized.\n");
- return NULL;
- }
- info = &dev->agp->agp_info;
-
- if (info->version.major != AGP_REQUIRED_MAJOR ||
- info->version.minor < AGP_REQUIRED_MINOR) {
- DRM_ERROR("Wrong agpgart version %d.%d\n"
- "\tYou need at least version %d.%d.\n",
- info->version.major,
- info->version.minor,
- AGP_REQUIRED_MAJOR,
- AGP_REQUIRED_MINOR);
- return NULL;
- }
-
-
- agp_be = drm_ctl_calloc(1, sizeof(*agp_be), DRM_MEM_TTM);
- if (!agp_be)
- return NULL;
-
- agp_be->mem = NULL;
-
- agp_be->bridge = dev->agp->bridge;
- agp_be->populated = false;
- agp_be->backend.func = &agp_ttm_backend;
- agp_be->backend.dev = dev;
-
- return &agp_be->backend;
-}
-EXPORT_SYMBOL(drm_agp_init_ttm);
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
void drm_agp_chipset_flush(struct drm_device *dev)
{