Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
ttm_bo.c File Reference
#include <drm/ttm/ttm_module.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_placement.h>
#include <linux/jiffies.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/file.h>
#include <linux/module.h>
#include <linux/atomic.h>

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   "[TTM] " fmt
 
#define TTM_ASSERT_LOCKED(param)
 
#define TTM_DEBUG(fmt, arg...)
 
#define TTM_BO_HASH_ORDER   13
 

Functions

int ttm_bo_wait_unreserved (struct ttm_buffer_object *bo, bool interruptible)
 
 EXPORT_SYMBOL (ttm_bo_wait_unreserved)
 
void ttm_bo_add_to_lru (struct ttm_buffer_object *bo)
 
int ttm_bo_del_from_lru (struct ttm_buffer_object *bo)
 
int ttm_bo_reserve_locked (struct ttm_buffer_object *bo, bool interruptible, bool no_wait, bool use_sequence, uint32_t sequence)
 
 EXPORT_SYMBOL (ttm_bo_reserve)
 
void ttm_bo_list_ref_sub (struct ttm_buffer_object *bo, int count, bool never_free)
 
int ttm_bo_reserve (struct ttm_buffer_object *bo, bool interruptible, bool no_wait, bool use_sequence, uint32_t sequence)
 
void ttm_bo_unreserve_locked (struct ttm_buffer_object *bo)
 
void ttm_bo_unreserve (struct ttm_buffer_object *bo)
 
 EXPORT_SYMBOL (ttm_bo_unreserve)
 
void ttm_bo_unref (struct ttm_buffer_object **p_bo)
 
 EXPORT_SYMBOL (ttm_bo_unref)
 
int ttm_bo_lock_delayed_workqueue (struct ttm_bo_device *bdev)
 
 EXPORT_SYMBOL (ttm_bo_lock_delayed_workqueue)
 
void ttm_bo_unlock_delayed_workqueue (struct ttm_bo_device *bdev, int resched)
 
 EXPORT_SYMBOL (ttm_bo_unlock_delayed_workqueue)
 
void ttm_bo_mem_put (struct ttm_buffer_object *bo, struct ttm_mem_reg *mem)
 
 EXPORT_SYMBOL (ttm_bo_mem_put)
 
int ttm_bo_mem_space (struct ttm_buffer_object *bo, struct ttm_placement *placement, struct ttm_mem_reg *mem, bool interruptible, bool no_wait_reserve, bool no_wait_gpu)
 
 EXPORT_SYMBOL (ttm_bo_mem_space)
 
int ttm_bo_wait_cpu (struct ttm_buffer_object *bo, bool no_wait)
 
 EXPORT_SYMBOL (ttm_bo_wait_cpu)
 
int ttm_bo_move_buffer (struct ttm_buffer_object *bo, struct ttm_placement *placement, bool interruptible, bool no_wait_reserve, bool no_wait_gpu)
 
int ttm_bo_validate (struct ttm_buffer_object *bo, struct ttm_placement *placement, bool interruptible, bool no_wait_reserve, bool no_wait_gpu)
 
 EXPORT_SYMBOL (ttm_bo_validate)
 
int ttm_bo_check_placement (struct ttm_buffer_object *bo, struct ttm_placement *placement)
 
int ttm_bo_init (struct ttm_bo_device *bdev, struct ttm_buffer_object *bo, unsigned long size, enum ttm_bo_type type, struct ttm_placement *placement, uint32_t page_alignment, unsigned long buffer_start, bool interruptible, struct file *persistent_swap_storage, size_t acc_size, struct sg_table *sg, void(*destroy)(struct ttm_buffer_object *))
 
 EXPORT_SYMBOL (ttm_bo_init)
 
size_t ttm_bo_acc_size (struct ttm_bo_device *bdev, unsigned long bo_size, unsigned struct_size)
 
 EXPORT_SYMBOL (ttm_bo_acc_size)
 
size_t ttm_bo_dma_acc_size (struct ttm_bo_device *bdev, unsigned long bo_size, unsigned struct_size)
 
 EXPORT_SYMBOL (ttm_bo_dma_acc_size)
 
int ttm_bo_create (struct ttm_bo_device *bdev, unsigned long size, enum ttm_bo_type type, struct ttm_placement *placement, uint32_t page_alignment, unsigned long buffer_start, bool interruptible, struct file *persistent_swap_storage, struct ttm_buffer_object **p_bo)
 
 EXPORT_SYMBOL (ttm_bo_create)
 
int ttm_bo_clean_mm (struct ttm_bo_device *bdev, unsigned mem_type)
 
 EXPORT_SYMBOL (ttm_bo_clean_mm)
 
int ttm_bo_evict_mm (struct ttm_bo_device *bdev, unsigned mem_type)
 
 EXPORT_SYMBOL (ttm_bo_evict_mm)
 
int ttm_bo_init_mm (struct ttm_bo_device *bdev, unsigned type, unsigned long p_size)
 
 EXPORT_SYMBOL (ttm_bo_init_mm)
 
void ttm_bo_global_release (struct drm_global_reference *ref)
 
 EXPORT_SYMBOL (ttm_bo_global_release)
 
int ttm_bo_global_init (struct drm_global_reference *ref)
 
 EXPORT_SYMBOL (ttm_bo_global_init)
 
int ttm_bo_device_release (struct ttm_bo_device *bdev)
 
 EXPORT_SYMBOL (ttm_bo_device_release)
 
int ttm_bo_device_init (struct ttm_bo_device *bdev, struct ttm_bo_global *glob, struct ttm_bo_driver *driver, uint64_t file_page_offset, bool need_dma32)
 
 EXPORT_SYMBOL (ttm_bo_device_init)
 
bool ttm_mem_reg_is_pci (struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
 
void ttm_bo_unmap_virtual_locked (struct ttm_buffer_object *bo)
 
void ttm_bo_unmap_virtual (struct ttm_buffer_object *bo)
 
 EXPORT_SYMBOL (ttm_bo_unmap_virtual)
 
int ttm_bo_wait (struct ttm_buffer_object *bo, bool lazy, bool interruptible, bool no_wait)
 
 EXPORT_SYMBOL (ttm_bo_wait)
 
int ttm_bo_synccpu_write_grab (struct ttm_buffer_object *bo, bool no_wait)
 
 EXPORT_SYMBOL (ttm_bo_synccpu_write_grab)
 
void ttm_bo_synccpu_write_release (struct ttm_buffer_object *bo)
 
 EXPORT_SYMBOL (ttm_bo_synccpu_write_release)
 
void ttm_bo_swapout_all (struct ttm_bo_device *bdev)
 
 EXPORT_SYMBOL (ttm_bo_swapout_all)
 

Macro Definition Documentation

#define pr_fmt (   fmt)    "[TTM] " fmt

Definition at line 31 of file ttm_bo.c.

#define TTM_ASSERT_LOCKED (   param)

Definition at line 44 of file ttm_bo.c.

#define TTM_BO_HASH_ORDER   13

Definition at line 46 of file ttm_bo.c.

#define TTM_DEBUG (   fmt,
  arg... 
)

Definition at line 45 of file ttm_bo.c.

Function Documentation

EXPORT_SYMBOL ( ttm_bo_wait_unreserved  )
EXPORT_SYMBOL ( ttm_bo_reserve  )
EXPORT_SYMBOL ( ttm_bo_unreserve  )
EXPORT_SYMBOL ( ttm_bo_unref  )
EXPORT_SYMBOL ( ttm_bo_lock_delayed_workqueue  )
EXPORT_SYMBOL ( ttm_bo_unlock_delayed_workqueue  )
EXPORT_SYMBOL ( ttm_bo_mem_put  )
EXPORT_SYMBOL ( ttm_bo_mem_space  )
EXPORT_SYMBOL ( ttm_bo_wait_cpu  )
EXPORT_SYMBOL ( ttm_bo_validate  )
EXPORT_SYMBOL ( ttm_bo_init  )
EXPORT_SYMBOL ( ttm_bo_acc_size  )
EXPORT_SYMBOL ( ttm_bo_dma_acc_size  )
EXPORT_SYMBOL ( ttm_bo_create  )
EXPORT_SYMBOL ( ttm_bo_clean_mm  )
EXPORT_SYMBOL ( ttm_bo_evict_mm  )
EXPORT_SYMBOL ( ttm_bo_init_mm  )
EXPORT_SYMBOL ( ttm_bo_global_release  )
EXPORT_SYMBOL ( ttm_bo_global_init  )
EXPORT_SYMBOL ( ttm_bo_device_release  )
EXPORT_SYMBOL ( ttm_bo_device_init  )
EXPORT_SYMBOL ( ttm_bo_unmap_virtual  )
EXPORT_SYMBOL ( ttm_bo_wait  )
EXPORT_SYMBOL ( ttm_bo_synccpu_write_grab  )
EXPORT_SYMBOL ( ttm_bo_synccpu_write_release  )
EXPORT_SYMBOL ( ttm_bo_swapout_all  )
size_t ttm_bo_acc_size ( struct ttm_bo_device bdev,
unsigned long  bo_size,
unsigned  struct_size 
)

ttm_bo_acc_size

: Pointer to a ttm_bo_device struct. : size of the buffer object in byte. : size of the structure holding buffer object datas

Returns size to account for a buffer object

Definition at line 1275 of file ttm_bo.c.

void ttm_bo_add_to_lru ( struct ttm_buffer_object bo)

ttm_bo_add_to_lru

: The buffer object.

Add this bo to the relevant mem type lru and, if it's backed by system pages (ttms) to the swap list. This function must be called with struct ttm_bo_global::lru_lock held, and is typically called immediately prior to unreserving a bo.

Definition at line 173 of file ttm_bo.c.

int ttm_bo_check_placement ( struct ttm_buffer_object bo,
struct ttm_placement placement 
)

ttm_bo_check_placement

: the buffer object. : placements

Performs minimal validity checking on an intended change of placement flags. Returns -EINVAL: Intended change is invalid or not allowed.

Definition at line 1167 of file ttm_bo.c.

int ttm_bo_clean_mm ( struct ttm_bo_device bdev,
unsigned  mem_type 
)

ttm_bo_clean_mm

: Pointer to a ttm_bo_device struct. : The memory type.

Take down a manager for a given memory type after first walking the LRU list to evict any buffers left alive.

Normally, this function is part of lastclose() or unload(), and at that point there shouldn't be any buffers left created by user-space, since there should've been removed by the file descriptor release() method. However, before this function is run, make sure to signal all sync objects, and verify that the delayed delete queue is empty. The driver must also make sure that there are no NO_EVICT buffers present in this memory type when the call is made.

If this function is part of a VT switch, the caller must make sure that there are no appications currently validating buffers before this function is called. The caller can do that by first taking the struct ttm_bo_device::ttm_lock in write mode.

Returns: -EINVAL: invalid or uninitialized memory type. -EBUSY: There are still buffers left in this memory type.

Definition at line 1361 of file ttm_bo.c.

int ttm_bo_create ( struct ttm_bo_device bdev,
unsigned long  size,
enum ttm_bo_type  type,
struct ttm_placement placement,
uint32_t  page_alignment,
unsigned long  buffer_start,
bool  interruptible,
struct file persistent_swap_storage,
struct ttm_buffer_object **  p_bo 
)

ttm_bo_synccpu_object_init

: Pointer to a ttm_bo_device struct. : Pointer to a ttm_buffer_object to be initialized. : Requested size of buffer object. : Requested type of buffer object. : Initial placement flags. : Data alignment in pages. : Virtual address of user space data backing a user buffer object. : If needing to sleep while waiting for GPU resources, sleep interruptible. : Usually the swap storage is deleted for buffers pinned in physical memory. If this behaviour is not desired, this member holds a pointer to a persistent shmem object. Typically, this would point to the shmem object backing a GEM object if TTM is used to back a GEM user interface. : On successful completion *p_bo points to the created object.

This function allocates a ttm_buffer_object, and then calls ttm_bo_init on that object. The destroy function is set to kfree(). Returns -ENOMEM: Out of memory. -EINVAL: Invalid placement flags. -ERESTARTSYS: Interrupted by signal while waiting for resources.

Definition at line 1304 of file ttm_bo.c.

int ttm_bo_del_from_lru ( struct ttm_buffer_object bo)

ttm_bo_del_from_lru

: The buffer object.

Remove this bo from all lru lists used to lookup and reserve an object. This function must be called with struct ttm_bo_global::lru_lock held, and is usually called just immediately after the bo has been reserved to avoid recursive reservation from lru lists.

Definition at line 195 of file ttm_bo.c.

int ttm_bo_device_init ( struct ttm_bo_device bdev,
struct ttm_bo_global glob,
struct ttm_bo_driver driver,
uint64_t  file_page_offset,
bool  need_dma32 
)

ttm_bo_device_init

: A pointer to a struct ttm_bo_device to initialize. : A pointer to an initialized struct ttm_bo_global. : A pointer to a struct ttm_bo_driver set up by the caller. : Offset into the device address space that is available for buffer data. This ensures compatibility with other users of the address space.

Initializes a struct ttm_bo_device: Returns: !0: Failure.

Definition at line 1553 of file ttm_bo.c.

int ttm_bo_device_release ( struct ttm_bo_device bdev)

Definition at line 1507 of file ttm_bo.c.

size_t ttm_bo_dma_acc_size ( struct ttm_bo_device bdev,
unsigned long  bo_size,
unsigned  struct_size 
)

Definition at line 1289 of file ttm_bo.c.

int ttm_bo_evict_mm ( struct ttm_bo_device bdev,
unsigned  mem_type 
)

ttm_bo_evict_mm

: Pointer to a ttm_bo_device struct. : The memory type.

Evicts all buffers on the lru list of the memory type. This is normally part of a VT switch or an out-of-memory-space-due-to-fragmentation handler. The caller must make sure that there are no other processes currently validating buffers, and can do that by taking the struct ttm_bo_device::ttm_lock in write mode.

Returns: -EINVAL: Invalid or uninitialized memory type. -ERESTARTSYS: The call was interrupted by a signal while waiting to evict a buffer.

Definition at line 1392 of file ttm_bo.c.

int ttm_bo_global_init ( struct drm_global_reference ref)

Definition at line 1464 of file ttm_bo.c.

void ttm_bo_global_release ( struct drm_global_reference ref)

Definition at line 1455 of file ttm_bo.c.

int ttm_bo_init ( struct ttm_bo_device bdev,
struct ttm_buffer_object bo,
unsigned long  size,
enum ttm_bo_type  type,
struct ttm_placement placement,
uint32_t  page_alignment,
unsigned long  buffer_start,
bool  interrubtible,
struct file persistent_swap_storage,
size_t  acc_size,
struct sg_table sg,
void(*)(struct ttm_buffer_object *)  destroy 
)

ttm_bo_init

: Pointer to a ttm_bo_device struct. : Pointer to a ttm_buffer_object to be initialized. : Requested size of buffer object. : Requested type of buffer object. : Initial placement flags. : Data alignment in pages. : Virtual address of user space data backing a user buffer object. : If needing to sleep to wait for GPU resources, sleep interruptible. : Usually the swap storage is deleted for buffers pinned in physical memory. If this behaviour is not desired, this member holds a pointer to a persistent shmem object. Typically, this would point to the shmem object backing a GEM object if TTM is used to back a GEM user interface. : Accounted size for this object. : Destroy function. Use NULL for kfree().

This function initializes a pre-allocated struct ttm_buffer_object. As this object may be part of a larger structure, this function, together with the function, enables driver-specific objects derived from a ttm_buffer_object. On successful return, the object kref and list_kref are set to 1. If a failure occurs, the function will call the function, or kfree() if is NULL. Thus, after a failure, dereferencing is illegal and will likely cause memory corruption.

Returns -ENOMEM: Out of memory. -EINVAL: Invalid placement flags. -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.

Definition at line 1176 of file ttm_bo.c.

int ttm_bo_init_mm ( struct ttm_bo_device bdev,
unsigned  type,
unsigned long  p_size 
)

ttm_bo_init_mm

: Pointer to a ttm_bo_device struct. : The memory type. : size managed area in pages.

Initialize a manager for a given memory type. Note: if part of driver firstopen, it must be protected from a potentially racing lastclose. Returns: -EINVAL: invalid size or memory type. -ENOMEM: Not enough memory. May also return driver-specified errors.

Definition at line 1410 of file ttm_bo.c.

void ttm_bo_list_ref_sub ( struct ttm_buffer_object bo,
int  count,
bool  never_free 
)

ttm_bo_list_ref_sub

: The buffer object. : The number of references with which to decrease ::list_kref; : The refcount should not reach zero with this operation.

Release lru list references to this buffer object.

Definition at line 276 of file ttm_bo.c.

int ttm_bo_lock_delayed_workqueue ( struct ttm_bo_device bdev)

ttm_bo_lock_delayed_workqueue

Prevent the delayed workqueue from running. Returns True if the workqueue was queued at the time

Definition at line 726 of file ttm_bo.c.

void ttm_bo_mem_put ( struct ttm_buffer_object bo,
struct ttm_mem_reg mem 
)

Definition at line 856 of file ttm_bo.c.

int ttm_bo_mem_space ( struct ttm_buffer_object bo,
struct ttm_placement placement,
struct ttm_mem_reg mem,
bool  interruptible,
bool  no_wait_reserve,
bool  no_wait_gpu 
)

Creates space for memory region according to its type.

This function first searches for free space in compatible memory types in the priority order defined by the driver. If free space isn't found, then ttm_bo_mem_force_space is attempted in priority order to evict and find space.

Definition at line 950 of file ttm_bo.c.

int ttm_bo_move_buffer ( struct ttm_buffer_object bo,
struct ttm_placement placement,
bool  interruptible,
bool  no_wait_reserve,
bool  no_wait_gpu 
)

Definition at line 1067 of file ttm_bo.c.

int ttm_bo_reserve ( struct ttm_buffer_object bo,
bool  interruptible,
bool  no_wait,
bool  use_sequence,
uint32_t  sequence 
)

ttm_bo_reserve:

: A pointer to a struct ttm_buffer_object. : Sleep interruptible if waiting. : Don't sleep while trying to reserve, rather return -EBUSY. : If is already reserved, Only sleep waiting for it to become unreserved if < ()->sequence.

Locks a buffer object for validation. (Or prevents other processes from locking it for validation) and removes it from lru lists, while taking a number of measures to prevent deadlocks.

Deadlocks may occur when two processes try to reserve multiple buffers in different order, either by will or as a result of a buffer being evicted to make room for a buffer already reserved. (Buffers are reserved before they are evicted). The following algorithm prevents such deadlocks from occurring: 1) Buffers are reserved with the lru spinlock held. Upon successful reservation they are removed from the lru list. This stops a reserved buffer from being evicted. However the lru spinlock is released between the time a buffer is selected for eviction and the time it is reserved. Therefore a check is made when a buffer is reserved for eviction, that it is still the first buffer in the lru list, before it is removed from the list. == 1 forces this check. If it fails, the function returns -EINVAL, and the caller should then choose a new buffer to evict and repeat the procedure. 2) Processes attempting to reserve multiple buffers other than for eviction, (typically execbuf), should first obtain a unique 32-bit validation sequence number, and call this function with == 1 and == the unique sequence number. If upon call of this function, the buffer object is already reserved, the validation sequence is checked against the validation sequence of the process currently reserving the buffer, and if the current validation sequence is greater than that of the process holding the reservation, the function returns -EAGAIN. Otherwise it sleeps waiting for the buffer to become unreserved, after which it retries reserving. The caller should, when receiving an -EAGAIN error release all its buffer reservations, wait for to become unreserved, and then rerun the validation with the same validation sequence. This procedure will always guarantee that the process with the lowest validation sequence will eventually succeed, preventing both deadlocks and starvation.

Returns: -EAGAIN: The reservation may cause a deadlock. Release all buffer reservations, wait for to become unreserved and try again. (only if use_sequence == 1). -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by a signal. Release all buffer reservations and return to user-space. -EBUSY: The function needed to sleep, but was true -EDEADLK: Bo already reserved using . This error code will only be returned if is set to true.

Definition at line 283 of file ttm_bo.c.

int ttm_bo_reserve_locked ( struct ttm_buffer_object bo,
bool  interruptible,
bool  no_wait,
bool  use_sequence,
uint32_t  sequence 
)

ttm_bo_reserve_locked:

: A pointer to a struct ttm_buffer_object. : Sleep interruptible if waiting. : Don't sleep while trying to reserve, rather return -EBUSY. : If is already reserved, Only sleep waiting for it to become unreserved if < ()->sequence.

Must be called with struct ttm_bo_global::lru_lock held, and will not remove reserved buffers from the lru lists. The function may release the LRU spinlock if it needs to sleep. Otherwise identical to ttm_bo_reserve.

Returns: -EAGAIN: The reservation may cause a deadlock. Release all buffer reservations, wait for to become unreserved and try again. (only if use_sequence == 1). -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by a signal. Release all buffer reservations and return to user-space. -EBUSY: The function needed to sleep, but was true -EDEADLK: Bo already reserved using . This error code will only be returned if is set to true.

Deadlock avoidance for multi-bo reserving.

We've already reserved this one.

Already reserved by a thread that will not back off for us. We need to back off.

Wake up waiters that may need to recheck for deadlock, if we decreased the sequence number.

Definition at line 216 of file ttm_bo.c.

void ttm_bo_swapout_all ( struct ttm_bo_device bdev)

Definition at line 1909 of file ttm_bo.c.

int ttm_bo_synccpu_write_grab ( struct ttm_buffer_object bo,
bool  no_wait 
)

ttm_bo_synccpu_write_grab

: The buffer object: : Return immediately if buffer is busy.

Synchronizes a buffer object for CPU RW access. This means blocking command submission that affects the buffer and waiting for buffer idle. This lock is recursive. Returns -EBUSY if the buffer is busy and no_wait is true. -ERESTARTSYS if interrupted by a signal.

Definition at line 1776 of file ttm_bo.c.

void ttm_bo_synccpu_write_release ( struct ttm_buffer_object bo)

ttm_bo_synccpu_write_release:

: The buffer object.

Releases a synccpu lock.

Definition at line 1798 of file ttm_bo.c.

void ttm_bo_unlock_delayed_workqueue ( struct ttm_bo_device bdev,
int  resched 
)

ttm_bo_unlock_delayed_workqueue

Allows the delayed workqueue to run.

Definition at line 732 of file ttm_bo.c.

void ttm_bo_unmap_virtual ( struct ttm_buffer_object bo)

ttm_bo_unmap_virtual

: tear down the virtual mappings for this BO

Definition at line 1632 of file ttm_bo.c.

void ttm_bo_unmap_virtual_locked ( struct ttm_buffer_object bo)

ttm_bo_unmap_virtual

: tear down the virtual mappings for this BO

The caller must take ttm_mem_io_lock before calling this function.

Definition at line 1620 of file ttm_bo.c.

void ttm_bo_unref ( struct ttm_buffer_object **  bo)

ttm_bo_unref

: The buffer object.

Unreference and clear a pointer to a buffer object.

Definition at line 714 of file ttm_bo.c.

void ttm_bo_unreserve ( struct ttm_buffer_object bo)

ttm_bo_unreserve

: A pointer to a struct ttm_buffer_object.

Unreserve a previous reservation of .

Definition at line 310 of file ttm_bo.c.

void ttm_bo_unreserve_locked ( struct ttm_buffer_object bo)

ttm_bo_unreserve_locked

: A pointer to a struct ttm_buffer_object.

Unreserve a previous reservation of . Needs to be called with struct ttm_bo_global::lru_lock held.

Definition at line 303 of file ttm_bo.c.

int ttm_bo_validate ( struct ttm_buffer_object bo,
struct ttm_placement placement,
bool  interruptible,
bool  no_wait_reserve,
bool  no_wait_gpu 
)

ttm_bo_validate

: The buffer object. : Proposed placement for the buffer object. : Sleep interruptible if sleeping. : Return immediately if other buffers are busy. : Return immediately if the GPU is busy.

Changes placement and caching policy of the buffer object according proposed placement. Returns -EINVAL on invalid proposed placement. -ENOMEM on out-of-memory condition. -EBUSY if no_wait is true and buffer busy. -ERESTARTSYS if interrupted by a signal.

Definition at line 1126 of file ttm_bo.c.

int ttm_bo_wait ( struct ttm_buffer_object bo,
bool  lazy,
bool  interruptible,
bool  no_wait 
)

ttm_bo_wait - wait for buffer idle.

: The buffer object. : Use interruptible wait. : Return immediately if buffer is busy.

This function must be called with the bo::mutex held, and makes sure any previous rendering to the buffer is completed. Note: It might be necessary to block validations before the wait by reserving the buffer. Returns -EBUSY if no_wait is true and the buffer is busy. Returns -ERESTARTSYS if interrupted by a signal.

Definition at line 1718 of file ttm_bo.c.

int ttm_bo_wait_cpu ( struct ttm_buffer_object bo,
bool  no_wait 
)

ttm_bo_wait_for_cpu

: Pointer to a struct ttm_buffer_object. : Don't sleep while waiting.

Wait until a buffer object is no longer sync'ed for CPU access. Returns: -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). -ERESTARTSYS: An interruptible sleep was interrupted by a signal.

Definition at line 1057 of file ttm_bo.c.

int ttm_bo_wait_unreserved ( struct ttm_buffer_object bo,
bool  interruptible 
)

ttm_bo_wait_unreserved

: A pointer to a struct ttm_buffer_object.

Wait for a struct ttm_buffer_object to become unreserved. This is typically used in the execbuf code to relax cpu-usage when a potential deadlock condition backoff.

Definition at line 161 of file ttm_bo.c.

bool ttm_mem_reg_is_pci ( struct ttm_bo_device bdev,
struct ttm_mem_reg mem 
)

ttm_mem_reg_is_pci

: Pointer to a struct ttm_bo_device. : A valid struct ttm_mem_reg.

Returns true if the memory described by is PCI memory, false otherwise.

Definition at line 1603 of file ttm_bo.c.