summaryrefslogtreecommitdiff
path: root/linux-core
AgeCommit message (Expand)Author
2005-05-28Re-implement the power management.Alan Hourihane
2005-05-27Modify drm_driver::device_is_agp to return a tri-state value to indicateIan Romanick
2005-05-21Change the MGA initialization and cleanup a bit. The dev_private structureIan Romanick
2005-05-20Refactor common, boilerplate ioctl code from drm_addbufs_* functions intoIan Romanick
2005-05-17Savage doesn't require AGP any more. Enable build even without CONFIG_AGP.Felix Kuehling
2005-05-16Added device_is_agp callback to drm_driver. This function is called by theIan Romanick
2005-04-26Convert BSD code to mostly use bus_dma, the dma abstraction for dealingEric Anholt
2005-04-20A fix for a locking bug which is triggered when a client tries to lock withThomas Hellstrom
2005-04-19Revert last commit, it affect via thingsDave Airlie
2005-03-29Add skeletal imagine driver (but don't build it yet).Adam Jackson
2005-03-28Via updates:Thomas Hellstrom
2005-03-27Description: Rather than use custom code in DRM_WAIT_ON() to do exactlyDave Airlie
2005-03-27Some ia64 platforms may not support write combining on all type of memory,Dave Airlie
2005-03-25fix up AGP multi-head support for kernel 2.6.12Dave Airlie
2005-03-25verify_area is deprecated, replaced by access_ok. Seems I missed this oneDave Airlie
2005-03-25fix bug with XFree86 4.3 on core drmDave Airlie
2005-03-253dfx DRM depends on PCIDave Airlie
2005-03-25For 2.6.12 and 2.6.11.x:Dave Airlie
2005-03-08Fix for bug 2673 from Egbert Eich - memset the versionDave Airlie
2005-02-08Close a race which could allow for privilege escalation by users with DRIEric Anholt
2005-02-07Invalid bound check of driver defined ioctls in drm_ioctlDave Airlie
2005-02-07change DRIVER_ to CORE_ makes things look nicer, also change it so theDave Airlie
2005-02-07fix agp detection on linuxDave Airlie
2005-02-05- Implement drm_initmap, and extend it with the resource number to helpEric Anholt
2005-02-01make functions static in i915, remove unused functionsDave Airlie
2005-02-01update i830 similiar to the kernel, add staticsDave Airlie
2005-02-01make more functions static in i810 and fix pageflip cleanupDave Airlie
2005-01-29fix radeon drvDave Airlie
2005-01-24hopefully fix drm_core setversion ioctl... pointed out by Eric on ircDave Airlie
2005-01-19Fix cut & paste problemAlan Hourihane
2005-01-16remove duplicate drm_sysfs.oDave Airlie
2005-01-16The patch makes drmAddBufs/drmMapBufs can handle buffers in video memoryDave Airlie
2005-01-15Setup MTRRs for frame buffer and aperture manually on Savage3D andFelix Kuehling
2005-01-12Use virt_to_page instead of vmalloc_to_page in drm_do_vm_shm_nopage forFelix Kuehling
2005-01-09Adjust 4 level page check for <= 2.6.10Jon Smirl
2005-01-07via updates: moved the verifier state struct to dev_priv. Implemented AGPThomas Hellstrom
2005-01-06Adjust drm-memory for 4 level page tables in 2.6.10 ifdef'd to use 3 levelsJon Smirl
2005-01-01Completeley rewritten Savage DRM which can be considered secure (moduloFelix Kuehling
2005-01-01Added a new DRM map type _DRM_CONSISTENT for consistent PCI memory. It usesFelix Kuehling
2005-01-01i810/i830 bug with Jon's file operations changesDave Airlie
2004-12-10Use wbinvd macro instead of assembly for it,Dave Airlie
2004-12-07Patch from Jon Smirl from Nov. 2nd that makes older X servers behave wellThomas Hellstrom
2004-12-03Added 3D functionality to the via command verifier. Modified the viaThomas Hellstrom
2004-11-11patch from bug 1803 - will try and push to kernel soonDave Airlie
2004-11-09Fix more build problems on linux-coreJon Smirl
2004-11-09make linux-core build againJon Smirl
2004-11-06Convert more drivers for bsd-core, moving the ioctl definitions to sharedEric Anholt
2004-11-06Fix Linux build. Why won't this complile? extern int const foo; staticJon Smirl
2004-11-06Commit WIP of BSD conversion to core model. Compiles for r128, radeon, butEric Anholt
2004-11-05Move ati_pcigart shared routines into drm-core moduleJon Smirl
;owner" basis. All regions associated with an "owner" can be released * with a simple call. Typically if the "owner" exists. The owner is any * "unsigned long" identifier. Can typically be a pointer to a file private * struct or a context identifier. * * Authors: * Thomas Hellström <thomas-at-tungstengraphics-dot-com> */ #include "drm_sman.h" typedef struct drm_owner_item { drm_hash_item_t owner_hash; struct list_head sman_list; struct list_head mem_blocks; } drm_owner_item_t; void drm_sman_takedown(drm_sman_t * sman) { drm_ht_remove(&sman->user_hash_tab); drm_ht_remove(&sman->owner_hash_tab); if (sman->mm) drm_free(sman->mm, sman->num_managers * sizeof(*sman->mm), DRM_MEM_MM); } EXPORT_SYMBOL(drm_sman_takedown); int drm_sman_init(drm_sman_t * sman, unsigned int num_managers, unsigned int user_order, unsigned int owner_order) { int ret = 0; sman->mm = (drm_sman_mm_t *) drm_calloc(num_managers, sizeof(*sman->mm), DRM_MEM_MM); if (!sman->mm) { ret = -ENOMEM; goto out; } sman->num_managers = num_managers; INIT_LIST_HEAD(&sman->owner_items); ret = drm_ht_create(&sman->owner_hash_tab, owner_order); if (ret) goto out1; ret = drm_ht_create(&sman->user_hash_tab, user_order); if (!ret) goto out; drm_ht_remove(&sman->owner_hash_tab); out1: drm_free(sman->mm, num_managers * sizeof(*sman->mm), DRM_MEM_MM); out: return ret; } EXPORT_SYMBOL(drm_sman_init); static void *drm_sman_mm_allocate(void *private, unsigned long size, unsigned alignment) { drm_mm_t *mm = (drm_mm_t *) private; drm_mm_node_t *tmp; tmp = drm_mm_search_free(mm, size, alignment, 1); if (!tmp) { return NULL; } tmp = drm_mm_get_block(tmp, size, alignment); return tmp; } static void drm_sman_mm_free(void *private, void *ref) { drm_mm_node_t *node = (drm_mm_node_t *) ref; drm_mm_put_block(node); } static void drm_sman_mm_destroy(void *private) { drm_mm_t *mm = (drm_mm_t *) private; drm_mm_takedown(mm); drm_free(mm, sizeof(*mm), DRM_MEM_MM); } static unsigned long drm_sman_mm_offset(void *private, void *ref) { drm_mm_node_t *node = (drm_mm_node_t *) ref; return node->start; } int drm_sman_set_range(drm_sman_t * sman, unsigned int manager, unsigned long start, unsigned long size) { drm_sman_mm_t *sman_mm; drm_mm_t *mm; int ret; BUG_ON(manager >= sman->num_managers); sman_mm = &sman->mm[manager]; mm = drm_calloc(1, sizeof(*mm), DRM_MEM_MM); if (!mm) { return -ENOMEM; } sman_mm->private = mm; ret = drm_mm_init(mm, start, size); if (ret) { drm_free(mm, sizeof(*mm), DRM_MEM_MM); return ret; } sman_mm->allocate = drm_sman_mm_allocate; sman_mm->free = drm_sman_mm_free; sman_mm->destroy = drm_sman_mm_destroy; sman_mm->offset = drm_sman_mm_offset; return 0; } EXPORT_SYMBOL(drm_sman_set_range); int drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, drm_sman_mm_t * allocator) { BUG_ON(manager >= sman->num_managers); sman->mm[manager] = *allocator; 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) { int ret; drm_hash_item_t *owner_hash_item; drm_owner_item_t *owner_item; ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); if (!ret) { return drm_hash_entry(owner_hash_item, drm_owner_item_t, owner_hash); } owner_item = drm_calloc(1, sizeof(*owner_item), DRM_MEM_MM); if (!owner_item) goto out; INIT_LIST_HEAD(&owner_item->mem_blocks); owner_item->owner_hash.key = owner; if (drm_ht_insert_item(&sman->owner_hash_tab, &owner_item->owner_hash)) goto out1; list_add_tail(&owner_item->sman_list, &sman->owner_items); return owner_item; out1: drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); out: return NULL; } drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, unsigned long size, unsigned alignment, unsigned long owner) { void *tmp; drm_sman_mm_t *sman_mm; drm_owner_item_t *owner_item; drm_memblock_item_t *memblock; BUG_ON(manager >= sman->num_managers); sman_mm = &sman->mm[manager]; tmp = sman_mm->allocate(sman_mm->private, size, alignment); if (!tmp) { return NULL; } memblock = drm_calloc(1, sizeof(*memblock), DRM_MEM_MM); if (!memblock) goto out; memblock->mm_info = tmp; memblock->mm = sman_mm; memblock->sman = sman; if (drm_ht_just_insert_please (&sman->user_hash_tab, &memblock->user_hash, (unsigned long)memblock, 32, 0, 0)) goto out1; owner_item = drm_sman_get_owner_item(sman, owner); if (!owner_item) goto out2; list_add_tail(&memblock->owner_list, &owner_item->mem_blocks); return memblock; out2: drm_ht_remove_item(&sman->user_hash_tab, &memblock->user_hash); out1: drm_free(memblock, sizeof(*memblock), DRM_MEM_MM); out: sman_mm->free(sman_mm->private, tmp); return NULL; } EXPORT_SYMBOL(drm_sman_alloc); static void drm_sman_free(drm_memblock_item_t *item) { drm_sman_t *sman = item->sman; list_del(&item->owner_list); drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); item->mm->free(item->mm->private, item->mm_info); drm_free(item, sizeof(*item), DRM_MEM_MM); } int drm_sman_free_key(drm_sman_t *sman, unsigned int key) { drm_hash_item_t *hash_item; drm_memblock_item_t *memblock_item; if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) return -EINVAL; memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash); drm_sman_free(memblock_item); return 0; } EXPORT_SYMBOL(drm_sman_free_key); static void drm_sman_remove_owner(drm_sman_t *sman, drm_owner_item_t *owner_item) { list_del(&owner_item->sman_list); drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); } int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) { drm_hash_item_t *hash_item; drm_owner_item_t *owner_item; if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { return -1; } owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); if (owner_item->mem_blocks.next == &owner_item->mem_blocks) { drm_sman_remove_owner(sman, owner_item); return -1; } return 0; } EXPORT_SYMBOL(drm_sman_owner_clean); static void drm_sman_do_owner_cleanup(drm_sman_t *sman, drm_owner_item_t *owner_item) { drm_memblock_item_t *entry, *next; list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, owner_list) { drm_sman_free(entry); } drm_sman_remove_owner(sman, owner_item); } void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner) { drm_hash_item_t *hash_item; drm_owner_item_t *owner_item; if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { return; } owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); drm_sman_do_owner_cleanup(sman, owner_item); } EXPORT_SYMBOL(drm_sman_owner_cleanup); void drm_sman_cleanup(drm_sman_t *sman) { drm_owner_item_t *entry, *next; unsigned int i; drm_sman_mm_t *sman_mm; list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) { drm_sman_do_owner_cleanup(sman, entry); } if (sman->mm) { for (i = 0; i < sman->num_managers; ++i) { sman_mm = &sman->mm[i]; if (sman_mm->private) { sman_mm->destroy(sman_mm->private); sman_mm->private = NULL; } } } } EXPORT_SYMBOL(drm_sman_cleanup);