summaryrefslogtreecommitdiff
path: root/shared-core
AgeCommit message (Expand)Author
2004-04-21centralise pci ids into one place and use scripts to generate files forDave Airlie
2004-04-121. Added a PCI ID.Thomas Hellstrom
2004-04-12Add mach64 to the trunkDave Airlie
2004-04-10white space changes to align with kernelDave Airlie
2004-04-08fix build problemAlan Hourihane
2004-04-08fixes from Linux kernelDave Airlie
2004-03-23Merged via-1-2-0Thomas Hellstrom
2004-03-12Fixes need to clean up the mess I made with the mesa merge. This codeJon Smirl
2004-02-18Fix sisfb header location for 2.6 kernelsMichel Daenzer
2004-01-10Make sure that all state packets are handled inMichel Daenzer
2004-01-10R200_PP_CUBIC_OFFSET_F1_[0-6] state packets only contain 5 offsets, not 6Michel Daenzer
2003-12-16Don't ioremap the framebuffer area. The ioremapped area wasn't used byEric Anholt
2003-11-05- Tie the DRM to a specific device: setunique no longer succeeds when givenEric Anholt
2003-11-05__linux__ is spelled with a lowercase 'l'Eric Anholt
2003-11-05Repo-copy linux/drm/kernel/drm.h to shared/drm/kernel/drm.h and use it onEric Anholt
2003-11-04Memory layout transition:Michel Daenzer
2003-10-23- Introduce a new ioctl, DRM_IOCTL_SET_VERSION. This ioctl allows theEric Anholt
2003-10-17- Move IRQ functions from drm_dma.h to new drm_irq.h and disentangle themEric Anholt
2003-10-17- Converted Linux drivers to initialize DRM instances based on PCI IDs, notEric Anholt
2003-10-16Introduce COMMIT_RING() as in radeon DRM, stop using error prone writebackMichel Daenzer
2003-10-16Try that again. It's a long.Eric Anholt
2003-10-16Debug printf format fix.Eric Anholt
2003-09-12resolve merge conflictsAlan Hourihane
2003-09-07Correct format in debug printfs (free is a pointer, not an int).Eric Anholt
2003-08-29Port the SiS DRM to FreeBSD. This includes the ability for the DRM toEric Anholt
2003-08-26Remove artificial PCI GART limitations, rename AGP to GART whereMichel Daenzer
2003-08-18Clean up Radeon DRI resume codeMichel Daenzer
2003-08-18Make r128_do_wait_for_idle static, as it's only used in this file.Eric Anholt
2003-08-18Remove an unnecessary #define __NO_VERSION__Eric Anholt
2003-08-12Whitespace cleanup from the pageflipping commit.Eric Anholt
2003-08-08Added some information as to when (which DRM version) various queries wereIan Romanick
2003-07-29IRQ code cleanup suggested by Linus TorvaldsMichel Daenzer
2003-07-26Degrade uninformative error message to debug message, as in other driversMichel Daenzer
2003-07-26Add Rage 128 pageflipping support, defaults to off. DRM version bump toEric Anholt
2003-07-25Compile fixes for recent 2.5/2.6 Linux kernels. I hope this doesn't breakMichel Daenzer
2003-06-16Possibly fix stanford checker complaints about sareaKeith Whitwell
2003-06-10Texture rectangle support for r100Keith Whitwell
2003-06-09Revert bogus last commitKeith Whitwell
2003-06-09Don't activate blend fallbacks unless blending is enabledKeith Whitwell
2003-05-28Restore change to _DRM_VBLANK_SIGNAL from rev. 1.41, which was revertedLeif Delgass
2003-05-27Merged DRM documentation.Jose Fonseca
2003-05-26Add support to r128 for MESA_ycbcr_texture (Ian Romanick, Leif Delgass)Leif Delgass
2003-05-20DRM part of Radeon DRI suspend/resume support (Charl Botha).David Dawes
2003-05-20Support for building DRM module on OpenBSD (Wilbern Cobb, Matthieu Herrb).David Dawes
2003-05-16Support AGP bridges where the AGP aperture can't be accessed directly byMichel Daenzer
2003-05-06fix warning on machines where sizeof(drm_addr_t) != 4 (Randy Dunlap)Michel Daenzer
2003-04-30Merged texmem-0-0-1Ian Romanick
2003-04-26Remove the map argument from DRM_*MEMORYBARRIER. Not all of the uses ofEric Anholt
2003-04-26Ensure driver has been initialized (dev_private != NULL) before installingLeif Delgass
2003-04-22get rid of superfluous fields in struct drm_radeon_ring_bufferMichel Daenzer
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * **************************************************************************/ /* * Simple memory manager interface that keeps track on allocate regions on a * per "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" struct drm_owner_item { struct drm_hash_item owner_hash; struct list_head sman_list; struct list_head mem_blocks; }; void drm_sman_takedown(struct drm_sman * 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(struct drm_sman * sman, unsigned int num_managers, unsigned int user_order, unsigned int owner_order) { int ret = 0; sman->mm = (struct drm_sman_mm *) 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) { struct drm_mm *mm = (struct drm_mm *) private; struct drm_mm_node *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) { struct drm_mm_node *node = (struct drm_mm_node *) ref; drm_mm_put_block(node); } static void drm_sman_mm_destroy(void *private) { struct drm_mm *mm = (struct drm_mm *) private; drm_mm_takedown(mm); drm_free(mm, sizeof(*mm), DRM_MEM_MM); } static unsigned long drm_sman_mm_offset(void *private, void *ref) { struct drm_mm_node *node = (struct drm_mm_node *) ref; return node->start; } int drm_sman_set_range(struct drm_sman * sman, unsigned int manager, unsigned long start, unsigned long size) { struct drm_sman_mm *sman_mm; struct drm_mm *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(struct drm_sman * sman, unsigned int manager, struct drm_sman_mm * allocator) { BUG_ON(manager >= sman->num_managers); sman->mm[manager] = *allocator; return 0; } EXPORT_SYMBOL(drm_sman_set_manager); static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman, unsigned long owner) { int ret; struct drm_hash_item *owner_hash_item; struct drm_owner_item *owner_item; ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); if (!ret) { return drm_hash_entry(owner_hash_item, struct drm_owner_item, 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; } struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int manager, unsigned long size, unsigned alignment, unsigned long owner) { void *tmp; struct drm_sman_mm *sman_mm; struct drm_owner_item *owner_item; struct drm_memblock_item *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(struct drm_memblock_item *item) { struct drm_sman *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(struct drm_sman *sman, unsigned int key) { struct drm_hash_item *hash_item; struct drm_memblock_item *memblock_item; if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) return -EINVAL; memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item, user_hash); drm_sman_free(memblock_item); return 0; } EXPORT_SYMBOL(drm_sman_free_key); static void drm_sman_remove_owner(struct drm_sman *sman, struct drm_owner_item *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(struct drm_sman *sman, unsigned long owner) { struct drm_hash_item *hash_item; struct drm_owner_item *owner_item; if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { return -1; } owner_item = drm_hash_entry(hash_item, struct drm_owner_item, 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(struct drm_sman *sman, struct drm_owner_item *owner_item) { struct drm_memblock_item *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(struct drm_sman *sman, unsigned long owner) { struct drm_hash_item *hash_item; struct drm_owner_item *owner_item; if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { return; } owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash); drm_sman_do_owner_cleanup(sman, owner_item); } EXPORT_SYMBOL(drm_sman_owner_cleanup); void drm_sman_cleanup(struct drm_sman *sman) { struct drm_owner_item *entry, *next; unsigned int i; struct drm_sman_mm *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);