Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
ttm_bo_util.c File Reference
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_placement.h>
#include <linux/io.h>
#include <linux/highmem.h>
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/module.h>

Go to the source code of this file.

Functions

void ttm_bo_free_old_node (struct ttm_buffer_object *bo)
 
int ttm_bo_move_ttm (struct ttm_buffer_object *bo, bool evict, bool no_wait_reserve, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
 
 EXPORT_SYMBOL (ttm_bo_move_ttm)
 
int ttm_mem_io_lock (struct ttm_mem_type_manager *man, bool interruptible)
 
void ttm_mem_io_unlock (struct ttm_mem_type_manager *man)
 
int ttm_mem_io_reserve_vm (struct ttm_buffer_object *bo)
 
void ttm_mem_io_free_vm (struct ttm_buffer_object *bo)
 
int ttm_mem_reg_ioremap (struct ttm_bo_device *bdev, struct ttm_mem_reg *mem, void **virtual)
 
void ttm_mem_reg_iounmap (struct ttm_bo_device *bdev, struct ttm_mem_reg *mem, void *virtual)
 
int ttm_bo_move_memcpy (struct ttm_buffer_object *bo, bool evict, bool no_wait_reserve, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
 
 EXPORT_SYMBOL (ttm_bo_move_memcpy)
 
pgprot_t ttm_io_prot (uint32_t caching_flags, pgprot_t tmp)
 
 EXPORT_SYMBOL (ttm_io_prot)
 
int ttm_bo_kmap (struct ttm_buffer_object *bo, unsigned long start_page, unsigned long num_pages, struct ttm_bo_kmap_obj *map)
 
 EXPORT_SYMBOL (ttm_bo_kmap)
 
void ttm_bo_kunmap (struct ttm_bo_kmap_obj *map)
 
 EXPORT_SYMBOL (ttm_bo_kunmap)
 
int ttm_bo_move_accel_cleanup (struct ttm_buffer_object *bo, void *sync_obj, void *sync_obj_arg, bool evict, bool no_wait_reserve, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
 
 EXPORT_SYMBOL (ttm_bo_move_accel_cleanup)
 

Function Documentation

EXPORT_SYMBOL ( ttm_bo_move_ttm  )
EXPORT_SYMBOL ( ttm_bo_move_memcpy  )
EXPORT_SYMBOL ( ttm_io_prot  )
EXPORT_SYMBOL ( ttm_bo_kmap  )
EXPORT_SYMBOL ( ttm_bo_kunmap  )
EXPORT_SYMBOL ( ttm_bo_move_accel_cleanup  )
void ttm_bo_free_old_node ( struct ttm_buffer_object bo)

ttm_bo_free_old_node

: A pointer to a struct ttm_buffer_object.

Utility function to free an old placement after a successful move.

Definition at line 40 of file ttm_bo_util.c.

int ttm_bo_kmap ( struct ttm_buffer_object bo,
unsigned long  start_page,
unsigned long  num_pages,
struct ttm_bo_kmap_obj map 
)

ttm_bo_kmap

: The buffer object. : The first page to map. : Number of pages to map. : pointer to a struct ttm_bo_kmap_obj representing the map.

Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the data in the buffer object. The ttm_kmap_obj_virtual function can then be used to obtain a virtual address to the data.

Returns -ENOMEM: Out of memory. -EINVAL: Invalid range.

Definition at line 546 of file ttm_bo_util.c.

void ttm_bo_kunmap ( struct ttm_bo_kmap_obj map)

ttm_bo_kunmap

: Object describing the map to unmap.

Unmaps a kernel map set up by ttm_bo_kmap.

Definition at line 581 of file ttm_bo_util.c.

int ttm_bo_move_accel_cleanup ( struct ttm_buffer_object bo,
void sync_obj,
void sync_obj_arg,
bool  evict,
bool  no_wait_reserve,
bool  no_wait_gpu,
struct ttm_mem_reg new_mem 
)

ttm_bo_move_accel_cleanup.

: A pointer to a struct ttm_buffer_object. : A sync object that signals when moving is complete. : An argument to pass to the sync object idle / wait functions. : This is an evict move. Don't return until the buffer is idle. : Return immediately if other buffers are busy. : Return immediately if the GPU is busy. : struct ttm_mem_reg indicating where to move.

Accelerated move function to be called when an accelerated move has been scheduled. The function will create a new temporary buffer object representing the old placement, and put the sync object on both buffer objects. After that the newly created buffer object is unref'd to be destroyed when the move is complete. This will help pipeline buffer moves.

This should help pipeline ordinary buffer moves.

Hang old buffer memory on a new buffer object, and leave it to be released when the GPU operation has completed.

If we're not moving to fixed memory, the TTM object needs to stay alive. Otherwhise hang it on the ghost bo to be unbound and destroyed.

Definition at line 612 of file ttm_bo_util.c.

int ttm_bo_move_memcpy ( struct ttm_buffer_object bo,
bool  evict,
bool  no_wait_reserve,
bool  no_wait_gpu,
struct ttm_mem_reg new_mem 
)

ttm_bo_move_memcpy

: A pointer to a struct ttm_buffer_object. : 1: This is an eviction. Don't try to pipeline. : Return immediately if other buffers are busy. : Return immediately if the GPU is busy. : struct ttm_mem_reg indicating where to move.

Fallback move function for a mappable buffer object in mappable memory. The function will, if successful, free any old aperture space, and set ()->mm_node to NULL, and update the ()->mem placement flags. If unsuccessful, the old data remains untouched, and it's up to the caller to free the memory space indicated by . Returns: !0: Failure.

Definition at line 316 of file ttm_bo_util.c.

int ttm_bo_move_ttm ( struct ttm_buffer_object bo,
bool  evict,
bool  no_wait_reserve,
bool  no_wait_gpu,
struct ttm_mem_reg new_mem 
)

ttm_bo_move_ttm

: A pointer to a struct ttm_buffer_object. : 1: This is an eviction. Don't try to pipeline. : Return immediately if other buffers are busy. : Return immediately if the GPU is busy. : struct ttm_mem_reg indicating where to move.

Optimized move function for a buffer object with both old and new placement backed by a TTM. The function will, if successful, free any old aperture space, and set ()->mm_node to NULL, and update the ()->mem placement flags. If unsuccessful, the old data remains untouched, and it's up to the caller to free the memory space indicated by . Returns: !0: Failure.

Definition at line 45 of file ttm_bo_util.c.

pgprot_t ttm_io_prot ( uint32_t  caching_flags,
pgprot_t  tmp 
)

ttm_io_prot

: Caching state. : Page protection flag for a normal, cached mapping.

Utility function that returns the pgprot_t that should be used for setting up a PTE with the caching model indicated by .

Definition at line 454 of file ttm_bo_util.c.

void ttm_mem_io_free_vm ( struct ttm_buffer_object bo)

Definition at line 173 of file ttm_bo_util.c.

int ttm_mem_io_lock ( struct ttm_mem_type_manager man,
bool  interruptible 
)

Definition at line 78 of file ttm_bo_util.c.

int ttm_mem_io_reserve_vm ( struct ttm_buffer_object bo)

Definition at line 153 of file ttm_bo_util.c.

void ttm_mem_io_unlock ( struct ttm_mem_type_manager man)

Definition at line 90 of file ttm_bo_util.c.

int ttm_mem_reg_ioremap ( struct ttm_bo_device bdev,
struct ttm_mem_reg mem,
void **  virtual 
)

Definition at line 184 of file ttm_bo_util.c.

void ttm_mem_reg_iounmap ( struct ttm_bo_device bdev,
struct ttm_mem_reg mem,
void virtual 
)

Definition at line 216 of file ttm_bo_util.c.