Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
drm_bufs.c File Reference
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/log2.h>
#include <linux/export.h>
#include <asm/shmparam.h>
#include <drm/drmP.h>

Go to the source code of this file.

Functions

int drm_addmap (struct drm_device *dev, resource_size_t offset, unsigned int size, enum drm_map_type type, enum drm_map_flags flags, struct drm_local_map **map_ptr)
 
 EXPORT_SYMBOL (drm_addmap)
 
int drm_addmap_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_rmmap_locked (struct drm_device *dev, struct drm_local_map *map)
 
 EXPORT_SYMBOL (drm_rmmap_locked)
 
int drm_rmmap (struct drm_device *dev, struct drm_local_map *map)
 
 EXPORT_SYMBOL (drm_rmmap)
 
int drm_rmmap_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_addbufs_pci (struct drm_device *dev, struct drm_buf_desc *request)
 
 EXPORT_SYMBOL (drm_addbufs_pci)
 
int drm_addbufs (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_infobufs (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_markbufs (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_freebufs (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_mapbufs (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_order (unsigned long size)
 
 EXPORT_SYMBOL (drm_order)
 

Detailed Description

Generic buffer template

Author
Rickard E. (Rik) Faith faith.nosp@m.@val.nosp@m.inux..nosp@m.com
Gareth Hughes garet.nosp@m.h@va.nosp@m.linux.nosp@m..com

Definition in file drm_bufs.c.

Function Documentation

int drm_addbufs ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Add buffers for DMA transfers (ioctl).

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
argpointer to a struct drm_buf_desc request.
Returns
zero on success or a negative number on failure.

According with the memory type specified in drm_buf_desc::flags and the build options, it dispatches the call either to addbufs_agp(), addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent PCI memory respectively.

Definition at line 1292 of file drm_bufs.c.

int drm_addbufs_pci ( struct drm_device dev,
struct drm_buf_desc request 
)

Definition at line 764 of file drm_bufs.c.

int drm_addmap ( struct drm_device dev,
resource_size_t  offset,
unsigned int  size,
enum drm_map_type  type,
enum drm_map_flags  flags,
struct drm_local_map **  map_ptr 
)

Definition at line 369 of file drm_bufs.c.

int drm_addmap_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Ioctl to specify a range of memory that is available for mapping by a non-root process.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
argpointer to a drm_map structure.
Returns
zero on success or a negative value on error.

Definition at line 395 of file drm_bufs.c.

int drm_freebufs ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Unreserve the buffers in list, previously reserved using drmDMA.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
argpointer to a drm_buf_free structure.
Returns
zero on success or a negative number on failure.

Calls free_buffer() for each used buffer. This function is primarily used for debugging.

Definition at line 1456 of file drm_bufs.c.

int drm_infobufs ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Get information about the buffer mappings.

This was originally mean for debugging purposes, or by a sophisticated client library to determine how best to use the available buffers (e.g., large buffers can be used for image transfer).

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
argpointer to a drm_buf_info structure.
Returns
zero on success or a negative number on failure.

Increments drm_device::buf_use while holding the drm_device::count_lock lock, preventing of allocating more buffers after this call. Information about each requested buffer is then copied into user space.

Definition at line 1333 of file drm_bufs.c.

int drm_mapbufs ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Maps all of the DMA buffers into client-virtual space (ioctl).

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
argpointer to a drm_buf_map structure.
Returns
zero on success or a negative number on failure.

Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information about each buffer into user space. For PCI buffers, it calls vm_mmap() with offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls drm_mmap_dma().

Definition at line 1506 of file drm_bufs.c.

int drm_markbufs ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Specifies a low and high water mark for buffer allocation

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arga pointer to a drm_buf_desc structure.
Returns
zero on success or a negative number on failure.

Verifies that the size order is bounded between the admissible orders and updates the respective drm_device_dma::bufs entry low and high water mark.

Note
This ioctl is deprecated and mostly never used.

Definition at line 1412 of file drm_bufs.c.

int drm_order ( unsigned long  size)

Compute size order. Returns the exponent of the smaller power of two which is greater or equal to given number.

Parameters
sizesize.
Returns
order.
Todo:
Can be made faster.

Definition at line 1602 of file drm_bufs.c.

int drm_rmmap ( struct drm_device dev,
struct drm_local_map *  map 
)

Definition at line 489 of file drm_bufs.c.

int drm_rmmap_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 516 of file drm_bufs.c.

int drm_rmmap_locked ( struct drm_device dev,
struct drm_local_map *  map 
)

Remove a map private from list and deallocate resources if the mapping isn't in use.

Searches the map on drm_device::maplist, removes it from the list, see if its being used, and free any associate resource (such as MTRR's) if it's not being on use.

See Also
drm_addmap

Definition at line 426 of file drm_bufs.c.

EXPORT_SYMBOL ( drm_addmap  )
EXPORT_SYMBOL ( drm_rmmap_locked  )
EXPORT_SYMBOL ( drm_rmmap  )
EXPORT_SYMBOL ( drm_addbufs_pci  )
EXPORT_SYMBOL ( drm_order  )