Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
drm_context.c File Reference
#include <drm/drmP.h>

Go to the source code of this file.

Functions

Context bitmap support
void drm_ctxbitmap_free (struct drm_device *dev, int ctx_handle)
 
int drm_ctxbitmap_init (struct drm_device *dev)
 
void drm_ctxbitmap_cleanup (struct drm_device *dev)
 
Per Context SAREA Support
int drm_getsareactx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_setsareactx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
The actual DRM context handling routines
int drm_resctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_addctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_modctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_getctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_switchctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_newctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_rmctx (struct drm_device *dev, void *data, struct drm_file *file_priv)
 

Detailed Description

IOCTLs for generic contexts

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_context.c.

Function Documentation

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

Add context.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx structure.
Returns
zero on success or a negative number on failure.

Get a new handle for the context and copy to userspace.

Definition at line 320 of file drm_context.c.

void drm_ctxbitmap_cleanup ( struct drm_device dev)

Context bitmap cleanup.

Parameters
devDRM device.

Free all idr members using drm_ctx_sarea_free helper function while holding the drm_device::struct_mutex lock.

Definition at line 118 of file drm_context.c.

void drm_ctxbitmap_free ( struct drm_device dev,
int  ctx_handle 
)

Free a handle from the context bitmap.

Parameters
devDRM device.
ctx_handlecontext handle.

Clears the bit specified by ctx_handle in drm_device::ctx_bitmap and the entry in drm_device::ctx_idr, while holding the drm_device::struct_mutex lock.

Definition at line 59 of file drm_context.c.

int drm_ctxbitmap_init ( struct drm_device dev)

Context bitmap initialization.

Parameters
devDRM device.

Initialise the drm_device::ctx_idr

Definition at line 104 of file drm_context.c.

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

Get context.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx structure.
Returns
zero on success or a negative number on failure.

Definition at line 371 of file drm_context.c.

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

Get per-context SAREA.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx_priv_map structure.
Returns
zero on success or a negative number on failure.

Gets the map from drm_device::ctx_idr with the handle specified and returns its handle.

Definition at line 143 of file drm_context.c.

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

Definition at line 356 of file drm_context.c.

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

New context.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx structure.
Returns
zero on success or a negative number on failure.

Calls context_switch_complete().

Definition at line 412 of file drm_context.c.

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

Reserve contexts.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx_res structure.
Returns
zero on success or a negative number on failure.

Definition at line 289 of file drm_context.c.

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

Remove context.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx structure.
Returns
zero on success or a negative number on failure.

If not the special kernel context, calls ctxbitmap_free() to free the specified context.

Definition at line 434 of file drm_context.c.

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

Set per-context SAREA.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx_priv_map structure.
Returns
zero on success or a negative number on failure.

Searches the mapping specified in arg and update the entry in drm_device::ctx_idr with it.

Definition at line 187 of file drm_context.c.

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

Switch context.

Parameters
inodedevice inode.
file_privDRM file private.
cmdcommand.
arguser argument pointing to a drm_ctx structure.
Returns
zero on success or a negative number on failure.

Calls context_switch().

Definition at line 392 of file drm_context.c.