summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2008-01-06nouveau: Add ctx_voodoo for NV86Jeremy Kolb
2008-01-05drm: One forgotten rename of 'mask' to 'proposed_flags'.Pekka Paalanen
2008-01-04via: add P4M900 pci id.Xavier Bachelot
2008-01-04[PATCH] nouveau: reset AGP on init for < nv40Stuart Bennett
2008-01-04[PATCH] nouveau: Fix nv20/30 context loadingStuart Bennett
2008-01-03mach64: some more minor cleanupsDave Airlie
2008-01-03mach64: cleanup some of the macro formattingDave Airlie
2008-01-03drm: cleanup DRM_DEBUG() parametersMárton Németh
2008-01-03Merge branch 'r500-support'Dave Airlie
2008-01-03remove duplicate pciidsDave Airlie
2007-12-26i915: return fence argument from i915_execbuffer ioctl32 routineXiang, Haihao
2007-12-25i915: i915_execbuffer ioctl32 routine, fix #13732Xiang, Haihao
2007-12-21Change drm_bo_type_dc to drm_bo_type_device and comment usage of this value.Keith Packard
2007-12-21Rename inappropriately named 'mask' fields to 'proposed_flags' instead.Keith Packard
2007-12-21Use dummy_read_page for unpopulated kernel-allocated ttm pages.Keith Packard
2007-12-21Move dummy_read_page from drm_ttm_set_user to drm_ttm_create.Keith Packard
2007-12-21Clean up and document drm_ttm.c APIs. drm_bind_ttm -> drm_ttm_bind.Keith Packard
2007-12-17drm: don't cast a pointer to pointer of list_headLi Zefan
2007-12-17While reading some code I stumbled across the use of 'err' inJesper Juhl
2007-12-15Document drm_ttm_set_user.Keith Packard
2007-12-15Document drm_buffer_object_validate function.Keith Packard
2007-12-15Document fence_class mess in drm_bo_setstatus_ioctlKeith Packard
2007-12-15Document drm_bo_handle_validate. Match drm_bo_do_validate parameter order.Keith Packard
2007-12-15Document drm_bo_do_validate. Remove spurious 'do_wait' parameter.Keith Packard
2007-12-15Make ttm create/destroy APIs consistent. Pass page_flags in create.Keith Packard
2007-12-15Revert "nouveau: nv30: missing ramin init, does it brake other hw?"Patrice Mandin
2007-12-13catch an out of memory conditionAlan Hourihane
2007-12-11Make relocation validate client computed values when debuggingKeith Packard
2007-12-11i915: wait for buffer idle before writing relocationsKeith Packard
2007-12-11Bump driver minor for relocation optimzationsKeith Packard
2007-12-11Allow relocation to be skipped when buffers don't move.Keith Packard
2007-12-10Merge branch 'master' into r500-supportDave Airlie
2007-12-10drm: move agp include outside CONFIG_AGP as it isn't dependant on agp in kernelDave Airlie
2007-12-08mach64: comment bus master / ring buffer behavior and securityJosé Fonseca
2007-12-07Fix pipe<->plane mapping vs. vblank handling (again)Jesse Barnes
2007-12-06take down stuff after asking driver to unloadDave Airlie
2007-12-05mach64: make buffer emission macros normal functionsJosé Fonseca
2007-12-05mach64: use utf-8José Fonseca
2007-12-05Remove references to the sarea_priv perf_boxes field.Kristian Høgsberg
2007-12-05patch from -mm kernel to use upper_32_bitsDave Airlie
2007-12-02bsd: Replace other occurrences of msleep with mtx_sleepRobert Noland
2007-12-02bsd: Now make secondary vblank workRobert Noland
2007-12-01bsd: Hook secondary vblank support.Robert Noland
2007-12-01bsd: Fix typo in i915_drv.cRobert Noland
2007-12-01mtx_sleep is preferred to msleepRobert Noland
2007-12-01Clarify order of operationsRobert Noland
2007-12-01DRM_DEBUG already prints the function name.Robert Noland
2007-12-01drm: Add _DRM_DRIVER map flag.Robert Noland
2007-12-01bsd: Move counter initialization to load time.Robert Noland
2007-11-30nouveau: Properly identify NV40 and NV44 generation.Maarten Maathuis
************************************************************************** * * Copyright 2006 Tungsten Graphics, Inc., Bismarck., ND., USA. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * 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; }