aboutsummaryrefslogtreecommitdiff
path: root/include/drm/ttm
AgeCommit message (Collapse)AuthorFilesLines
2016-07-07drm/ttm: remove TTM_BO_PRIV_FLAG_MOVINGChristian König2-5/+2
Instead of using the flag just remember the fence of the last move operation. This avoids waiting for command submissions pipelined after the move, but before accessing the BO with the CPU again. Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-07-07drm/ttm: remove no_gpu_wait param from ttm_bo_move_accel_cleanupChristian König1-3/+1
It isn't used and not waiting for the GPU after scheduling a move is actually quite dangerous. Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-07-07drm/ttm: wait for BO idle in ttm_bo_move_memcpyChristian König1-1/+3
When we want to pipeline accelerated moves we need to wait in the fallback path. Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-07-07drm/ttm: cleanup ttm_tt_(unbind|destroy)Christian König1-9/+0
ttm_tt_destroy should be the only one unbinding the object. Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-07-01drm/ttm: Make ttm_bo_mem_compat availableSinclair Yeh1-0/+14
There are cases where it is desired to see if a proposed placement is compatible with a buffer object before calling ttm_bo_validate(). Signed-off-by: Sinclair Yeh <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]> Cc: <[email protected]> --- This is the first of a 3-patch series to fix a black screen issue observed on Ubuntu 16.04 server.
2016-05-04drm/ttm: implement LRU add callbacks v2Christian König1-0/+9
This allows fine grained control for the driver where to add a BO into the LRU. v2: fix typo in comment Reviewed-by: Sinclair Yeh <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-05-04drm/ttm: add optional LRU removal callback v2Christian König1-0/+6
Useful for driver specific LRU handling. v2: fix typo in comment Reviewed-by: Sinclair Yeh <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-05-04drm/ttm: remove unused validation sequenceChristian König1-2/+0
Not used any more. Reviewed-by: Sinclair Yeh <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-05-04drm/ttm: remove lazy parameter from ttm_bo_waitChristian König1-1/+1
Not used any more. Reviewed-by: Sinclair Yeh <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-05-04drm/ttm: remove use_ticket parameter from ttm_bo_reserveChristian König1-9/+5
Not used any more. Reviewed-by: Sinclair Yeh <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-04-22Merge tag 'v4.6-rc3' into drm-nextDave Airlie1-1/+1
Backmerge 4.6-rc3 for i915. Linux 4.6-rc3
2016-04-04drm/ttm: use phys_addr_t for ttm_bus_placementAlex Deucher1-1/+1
Fixes ttm on platforms like PPC460 where the CPU is in 32-bit mode, but the physical addresses are >32 bits. Extracted from a patch by Hans Verkuil. Tested-by: Julian Margetson <[email protected]> Acked-by: Thomas Hellstrom <[email protected]> Reviewed-by: Christian König <[email protected]> Cc: Thomas Hellstrom <[email protected]> Cc: Julian Margetson <[email protected]> Cc: Hans Verkuil <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2016-03-30drm/ttm: Remove TTM_HAS_AGPDaniel Vetter1-2/+1
It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere. Also use the neat Makefile magic to make the entire ttm_agp_backend file optional. v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville v3: Review from Emil. v4: Actually get it right as spotted by 0-day. Cc: Emil Velikov <[email protected]> Cc: Ville Syrjälä <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-01-13drm/ttm: add ttm_bo_move_to_lru_tail function v2Christian König1-0/+10
This allows the drivers to move a BO to the end of the LRU without removing and adding it again. v2: Make it more robust, handle pinned and swapable BOs as well. Reviewed-by: Thomas Hellstrom <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2015-12-15drm/ttm: fix documentation of ttm_bo_reserveNicolai Hähnle1-2/+2
Previously, the comment was inconsistent. EDEADLK is what the ww_mutex mechanism really returns. Signed-off-by: Nicolai Hähnle <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2015-03-05drm/ttm: device address space != CPU address spaceAlex Deucher2-2/+2
We need to store device offsets in 64 bit as the device address space may be larger than the CPU's. Fixes GPU init failures on radeons with 4GB or more of vram on 32 bit kernels. We put vram at the start of the GPU's address space so the gart aperture starts at 4 GB causing all GPU addresses in the gart aperture to get truncated. bug: https://bugs.freedesktop.org/show_bug.cgi?id=89072 [airlied: fix warning on nouveau build] Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] Acked-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2014-12-03drm/ttm: optionally move duplicates to a separate listChristian König1-1/+8
This patch adds an optional list_head parameter to ttm_eu_reserve_buffers. If specified duplicates in the execbuf list are no longer reported as errors, but moved to this list instead. Reviewed-by: Thomas Hellstrom <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2014-09-30drm/ttm: add reservation_object as argument to ttm_bo_initMaarten Lankhorst1-0/+2
This allows importing reservation objects from dma-bufs. Signed-off-by: Maarten Lankhorst <[email protected]>
2014-09-11drm/ttm: allow fence to be added as sharedChristian König1-0/+2
This patch adds a new flag to the ttm_validate_buffer list to add the fence as shared to the reservation object. Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2014-09-02drm/ttm: flip the switch, and convert to dma_fenceMaarten Lankhorst3-33/+5
Signed-off-by: Maarten Lankhorst <[email protected]>
2014-09-01drm/ttm: kill off some members to ttm_validate_bufferMaarten Lankhorst1-3/+0
This reorders the list to keep track of what buffers are reserved, so previous members are always unreserved. This gets rid of some bookkeeping that's no longer needed, while simplifying the code some. Signed-off-by: Maarten Lankhorst <[email protected]>
2014-09-01drm/ttm: add interruptible parameter to ttm_eu_reserve_buffersMaarten Lankhorst1-4/+5
It seems some drivers really want this as a parameter, like vmwgfx. Signed-off-by: Maarten Lankhorst <[email protected]>
2014-09-01drm/ttm: kill fence_lockMaarten Lankhorst2-7/+1
No users are left, kill it off! :D Conversion to the reservation api is next on the list, after that the functionality can be restored with rcu. Signed-off-by: Maarten Lankhorst <[email protected]>
2014-08-27drm/ttm: move fpfn and lpfn into each placement v2Christian König2-24/+19
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-08-10drm/ttm: expose CPU address of DMA-allocated pagesAlexandre Courbot1-0/+2
Pages allocated using the DMA API have a coherent memory mapping. Make this mapping visible to drivers so they can decide to use it instead of creating their own redundant one. Signed-off-by: Alexandre Courbot <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Ben Skeggs <[email protected]>
2014-07-08drm/ttm: fix handling of TTM_PL_FLAG_TOPDOWN v2Christian König1-0/+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-07-08drm/ttm: remove declaration of ttm_tt_cache_flushAlexandre Courbot1-12/+0
ttm_tt_cache_flush's implementation was removed in 2009 by commit c9c97b8c, but its declaration has been hiding in ttm_bo_driver.h since then. It has been surviving in the dark for too long now ; give it the mercy blow. Reviewed-by: Thierry Reding <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Alexandre Courbot <[email protected]> Signed-off-by: David Herrmann <[email protected]>
2014-05-26drm/ttm: fix kerneldoc of ttm_bo_createAlexandre Courbot1-3/+2
The kerneldoc header of ttm_bo_create() was referring to another (nonexisting) function and had a few obsolete or incorrect arguments. Signed-off-by: Alexandre Courbot <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2014-04-05Merge tag 'ttm-next-2014-04-04' of ↵Dave Airlie1-18/+29
git://people.freedesktop.org/~thomash/linux into drm-next Pull request of 2014-04-04 Currently only a single patch fixing up mixed use of the ttm_bo_reserve and ww_mutex APIs * tag 'ttm-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux: drm/ttm: Hide the implementation details of reservation
2014-04-04drm/ttm: Hide the implementation details of reservationThomas Hellstrom1-18/+29
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-04-04drm: Add support for two-ended allocation, v3Lauri Kasanen1-0/+3
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]>
2014-03-28drm/ttm: Add a ttm_ref_object_exists functionThomas Hellstrom1-0/+4
A function to be used to check whether a caller has put a ref object (opened) a struct ttm_base_object Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-03-16drm: init TTM dev_mapping in ttm_bo_device_init()David Herrmann1-0/+2
With dev->anon_inode we have a global address_space ready for operation right from the beginning. Therefore, there is no need to do a delayed setup with TTM. Instead, set dev_mapping during initialization in ttm_bo_device_init() and remove any "if (dev_mapping)" conditions. Cc: Dave Airlie <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Thomas Hellstrom <[email protected]> Signed-off-by: David Herrmann <[email protected]>
2014-02-18drm/ttm: declare 'struct device' in ttm_page_alloc.hAlexandre Courbot1-0/+2
Declare 'struct device' explicitly in ttm_page_alloc.h as this file does not include any file declaring it. This removes the following warning: warning: 'struct device' declared inside parameter list Signed-off-by: Alexandre Courbot <[email protected]> Reviewed-by: Thierry Reding <[email protected]>
2014-01-14Merge tag 'vmwgfx-next-2014-01-13' of ↵Dave Airlie1-2/+16
git://people.freedesktop.org/~thomash/linux into drm-next Anyway, nothing big here, Three more code cleanup patches from Rashika Kheria, and one TTM/vmwgfx patch from me that tightens security around TTM objects enough for them to opened using prime objects from render nodes: Previously any client could access a shared buffer using the "name", also without actually opening it. Now a reference is required, and for render nodes such a reference is intended to only be obtainable using a prime fd. vmwgfx-next 2014-01-13 pull request * tag 'vmwgfx-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux: drivers: gpu: Mark functions as static in vmwgfx_fence.c drivers: gpu: Mark functions as static in vmwgfx_buffer.c drivers: gpu: Mark functions as static in vmwgfx_kms.c drm/ttm: ttm object security fixes for render nodes
2014-01-08drm/ttm: ttm object security fixes for render nodesThomas Hellstrom1-2/+16
When a client looks up a ttm object, don't look it up through the device hash table, but rather from the file hash table. That makes sure that the client has indeed put a reference on the object, or in gem terms, has opened the object; either using prime or using the global "name". To avoid a performance loss, make sure the file hash table entries can be looked up from under an RCU lock, and as a consequence, replace the rwlock with a spinlock, since we never need to take it in read mode only anymore. Finally add a ttm object lookup function for the device hash table, that is intended to be used when we put a ref object on a base object or, in gem terms, when we open the object. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-01-08drm/ttm: Correctly set page mapping and -index membersThomas Hellstrom1-0/+9
Needed for some vm operations; most notably unmap_mapping_range() with even_cows = 0. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2013-11-21Merge branch 'ttm-fixes-3.13' of git://people.freedesktop.org/~thomash/linux ↵Dave Airlie1-1/+3
into drm-fixes The set_need_resched() removal fix and yet another fix in ttm_bo_move_memcpy(). * 'ttm-fixes-3.13' of git://people.freedesktop.org/~thomash/linux: drm/ttm: Remove set_need_resched from the ttm fault handler drm/ttm: Don't move non-existing data
2013-11-20drm/ttm: Remove set_need_resched from the ttm fault handlerThomas Hellstrom1-1/+3
Addresses "[BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE". In the first occurence it was used to try to be nice while releasing the mmap_sem and retrying the fault to work around a locking inversion. The second occurence was never used. There has been some discussion whether we should change the locking order to mmap_sem -> bo_reserve. This patch doesn't address that issue, and leaves that locking order undefined. The solution that we release the mmap_sem if tryreserve fails and wait for the buffer to become unreserved is something we want in any case, and follows how the core vm system waits for pages to be come unlocked while releasing the mmap_sem. The code also outlines what needs to be changed if we want to establish the locking order as mmap_sem -> bo::reserve. One slight issue that remains with this code is that the fault handler might be prone to starvation if another thread countinously reserves the buffer. IMO that usage pattern is highly unlikely. Signed-off-by: Thomas Hellstrom <[email protected]>
2013-11-18drm/ttm: Add a minimal prime implementation for ttm base objectsThomas Hellstrom1-2/+59
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-11-18drm/ttm: Allow execbuf util reserves without ticketThomas Hellstrom1-1/+2
If no reservation ticket is given to the execbuf reservation utilities, try reservation with non-blocking semantics. This is intended for eviction paths that use the execbuf reservation utilities for convenience rather than for deadlock avoidance. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-11-06drm/ttm: Enable the dma page pool also for intel IOMMUsThomas Hellstrom1-1/+10
Used by the vmwgfx driver Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>
2013-07-25drm/ttm: convert to unified vma offset managerDavid Herrmann2-17/+8
Use the new vma-manager infrastructure. This doesn't change any implementation details as the vma-offset-manager is nearly copied 1-to-1 from TTM. The vm_lock is moved into the offset manager so we can drop it from TTM. During lookup, we use the vma locking helpers to take a reference to the found object. In all other scenarios, locking stays the same as before. We always guarantee that drm_vma_offset_remove() is called only during destruction. Hence, helpers like drm_vma_node_offset_addr() are always safe as long as the node has a valid offset. This also drops the addr_space_offset member as it is a copy of vm_start in vma_node objects. Use the accessor functions instead. v4: - remove vm_lock - use drm_vma_offset_lock_lookup() to protect lookup (instead of vm_lock) Cc: Dave Airlie <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Martin Peres <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Thomas Hellstrom <[email protected]> Signed-off-by: David Herrmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-06-28drm/ttm: get rid of ttm_bo_is_reservedMaarten Lankhorst1-14/+0
Signed-off-by: Maarten Lankhorst <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-06-28drm/ttm: inline ttm_bo_reserve and related callsMaarten Lankhorst1-70/+105
Makes lockdep a lot more useful. Signed-off-by: Maarten Lankhorst <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-06-28drm/ttm: convert to the reservation apiMaarten Lankhorst2-20/+6
Now that the code is compatible in semantics, flip the switch. Use ww_mutex instead of the homegrown implementation. ww_mutex uses -EDEADLK to signal that the caller has to back off, and -EALREADY to indicate this buffer is already held by the caller. ttm used -EAGAIN and -EDEADLK for those, respectively. So some changes were needed to handle this correctly. Signed-off-by: Maarten Lankhorst <[email protected]> Reviewed-by: Jerome Glisse <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-06-28drm/ttm: make ttm reservation calls behave like reservation callsMaarten Lankhorst3-13/+34
This commit converts the source of the val_seq counter to the ww_mutex api. The reservation objects are converted later, because there is still a lockdep splat in nouveau that has to resolved first. Signed-off-by: Maarten Lankhorst <[email protected]> Reviewed-by: Jerome Glisse <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-04-12ttm: export functions to allow qxl do its own iomappingDave Airlie1-0/+4
qxl wants to use io mapping like i915 gem does, for now just export the symbols so the driver can implement atomic page maps using io mapping. Signed-off-by: Dave Airlie <[email protected]>
2013-01-15drm/ttm: unexport ttm_bo_wait_unreservedMaarten Lankhorst1-12/+0
All legitimate users of this function outside ttm_bo.c are gone, now it's only an implementation detail. Signed-off-by: Maarten Lankhorst <[email protected]> Reviewed-by: Jerome Glisse <[email protected]>
2013-01-15drm/ttm: add ttm_bo_reserve_slowpathMaarten Lankhorst1-0/+30
Instead of dropping everything, waiting for the bo to be unreserved and trying over, a better strategy would be to do a blocking wait. This can be mapped a lot better to a mutex_lock-like call. Signed-off-by: Maarten Lankhorst <[email protected]> Reviewed-by: Jerome Glisse <[email protected]>