aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_bo_manager.c
AgeCommit message (Collapse)AuthorFilesLines
2018-05-15Add SPDX idenitifier and clarify licenseDirk Hohndel1-0/+1
This is dual licensed under GPL-2.0 or MIT. Signed-off-by: Dirk Hohndel (VMware) <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2017-08-17drm/ttm: make ttm_mem_type_manager_func debug more usefulChristian König1-3/+2
Provide the drm printer directly instead of just the callback. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2017-02-03drm: Improve drm_mm search (and fix topdown allocation) with rbtreesChris Wilson1-10/+8
The drm_mm range manager claimed to support top-down insertion, but it was neither searching for the top-most hole that could fit the allocation request nor fitting the request to the hole correctly. In order to search the range efficiently, we create a secondary index for the holes using either their size or their address. This index allows us to find the smallest hole or the hole at the bottom or top of the range efficiently, whilst keeping the hole stack to rapidly service evictions. v2: Search for holes both high and low. Rename flags to mode. v3: Discover rb_entry_safe() and use it! v4: Kerneldoc for enum drm_mm_insert_mode. Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Joonas Lahtinen <[email protected]> Cc: Alex Deucher <[email protected]> Cc: "Christian König" <[email protected]> Cc: David Airlie <[email protected]> Cc: Russell King <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Sean Paul <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Christian Gmeiner <[email protected]> Cc: Rob Clark <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Stephen Warren <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Eric Anholt <[email protected]> Cc: Sinclair Yeh <[email protected]> Cc: Thomas Hellstrom <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]> # vmwgfx Reviewed-by: Lucas Stach <[email protected]> #etnaviv Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm/mm: Convert to drm_printerDaniel Vetter1-1/+2
Including all drivers. I thought about keeping small compat functions to avoid having to change all drivers. But I really like the drm_printer idea, so figured spreading it more widely is a good thing. v2: Review from Chris: - Natural argument order and better name for drm_mm_print. - show_mm() macro in the selftest. Cc: Rob Clark <[email protected]> Cc: Russell King <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Christian König <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Tomi Valkeinen <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Jyri Sarha <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-18drm/ttm: use designated initializersKees Cook1-5/+5
Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/20161217010011.GA140300@beast
2014-11-12drm/ttm: Use only DRM_MM_SEARCH_BELOW for TTM_PL_FLAG_TOPDOWNMichel Dänzer1-1/+1
DRM_MM_SEARCH_BEST gets the smallest hole which can fit the BO. That seems against the idea of TTM_PL_FLAG_TOPDOWN: * The smallest hole may be in the overall bottom of the area * If the hole isn't much larger than the BO, it doesn't make much difference whether the BO is placed at the bottom or at the top of the hole Reviewed-by: Lauri Kasanen <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2014-11-12drm/ttm: Add DRM_MM_SEARCH_BELOW for TTM_PL_FLAG_TOPDOWNMichel Dänzer1-3/+5
If the BO should be placed at the top of the area, we should start looking for holes from the top. Reviewed-by: Lauri Kasanen <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2014-08-27drm/ttm: move fpfn and lpfn into each placement v2Christian König1-5/+4
This allows us to more fine grained specify where to place the buffer object. v2: rebased on drm-next, add bochs changes as well Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
2014-07-08drm/ttm: fix handling of TTM_PL_FLAG_TOPDOWN v2Christian König1-1/+2
bo->mem.placement is not initialized when ttm_bo_man_get_node is called, so the flag had no effect at all. v2: change nouveau and vmwgfx as well Signed-off-by: Christian König <[email protected]> Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
2014-04-04drm: Add support for two-ended allocation, v3Lauri Kasanen1-3/+8
Clients like i915 need to segregate cache domains within the GTT which can lead to small amounts of fragmentation. By allocating the uncached buffers from the bottom and the cacheable buffers from the top, we can reduce the amount of wasted space and also optimize allocation of the mappable portion of the GTT to only those buffers that require CPU access through the GTT. For other drivers, allocating small bos from one end and large ones from the other helps improve the quality of fragmentation. Based on drm_mm work by Chris Wilson. v3: Changed to use a TTM placement flag v2: Updated kerneldoc Cc: Chris Wilson <[email protected]> Cc: Ben Widawsky <[email protected]> Cc: Christian König <[email protected]> Signed-off-by: Lauri Kasanen <[email protected]> Signed-off-by: David Airlie <[email protected]>
2013-08-07drm/ttm: replace drm_mm_pre_get() by direct allocDavid Herrmann1-22/+20
Instead of calling drm_mm_pre_get() in a row, we now preallocate the node and then use the atomic insertion functions. This has the exact same semantics and there is no reason to use the racy pre-allocations. Note that ttm_bo_man_get_node() does not run in atomic context. Nouveau already uses GFP_KERNEL alloc in nouveau/nouveau_ttm.c in nouveau_gart_manager_new(). So we can do the same in ttm_bo_man_get_node(). Signed-off-by: David Herrmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-08-07drm/mm: add "best_match" flag to drm_mm_insert_node()David Herrmann1-1/+2
Add a "best_match" flag similar to the drm_mm_search_*() helpers so we can convert TTM to use them in follow up patches. We can also inline the non-generic helpers and move them into the header to allow compile-time optimizations. To make calls to drm_mm_{search,insert}_node() more readable, this converts the boolean argument to a flagset. There are pending patches that add additional flags for top-down allocators and more. v2: - use flag parameter instead of boolean "best_match" - convert *_search_free() helpers to also use flags argument Signed-off-by: David Herrmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-07-02drm: make drm_mm_init() return voidDavid Herrmann1-7/+1
There is no reason to return "int" as this function never fails. Furthermore, several drivers (ast, sis) already depend on this. Signed-off-by: David Herrmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2012-10-02UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/David Howells1-4/+4
Convert #include "..." to #include <path/...> in drivers/gpu/. Signed-off-by: David Howells <[email protected]> Acked-by: Dave Airlie <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Acked-by: Dave Jones <[email protected]>
2010-11-09drm/ttm: Use private locks for the default bo range managerThomas Hellstrom1-36/+45
Searching for a free block in the range manager may in some situations be a lenghty operation, and we want to avoid holding the global lru lock during that time. Instead use a per-manager spinlock. This leaves the global lru lock for quick lru list and swap list manipulation only, including list manipulation associated with reserving buffer objects. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2010-10-21drm/ttm: Avoid using the ttm_mem_type_manager::put_locked functionThomas Hellstrom1-10/+0
Release the lru spinlock early. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2010-10-19drm/ttm: add unlocked variant of new manager put node.Dave Airlie1-0/+10
We need the unlocked variant for the new codepath introduced to fix the race condition in master recently. Signed-off-by: Dave Airlie <[email protected]>
2010-10-05drm/ttm: restructure to allow driver to plug in alternate memory managerBen Skeggs1-0/+148
Nouveau will need this on GeForce 8 and up to account for the GPU reordering physical VRAM for some memory types. Reviewed-by: Jerome Glisse <[email protected]> Acked-by: Thomas Hellström <[email protected]> Signed-off-by: Ben Skeggs <[email protected]>