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

Go to the source code of this file.

Functions

int drm_lock (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_unlock (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int drm_lock_free (struct drm_lock_data *lock_data, unsigned int context)
 
void drm_idlelock_take (struct drm_lock_data *lock_data)
 
 EXPORT_SYMBOL (drm_idlelock_take)
 
void drm_idlelock_release (struct drm_lock_data *lock_data)
 
 EXPORT_SYMBOL (drm_idlelock_release)
 
int drm_i_have_hw_lock (struct drm_device *dev, struct drm_file *file_priv)
 

Detailed Description

IOCTLs for locking

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

Function Documentation

int drm_i_have_hw_lock ( struct drm_device dev,
struct drm_file *  file_priv 
)

Definition at line 367 of file drm_lock.c.

void drm_idlelock_release ( struct drm_lock_data *  lock_data)

Definition at line 347 of file drm_lock.c.

void drm_idlelock_take ( struct drm_lock_data *  lock_data)

This function returns immediately and takes the hw lock with the kernel context if it is free, otherwise it gets the highest priority when and if it is eventually released.

This guarantees that the kernel will eventually have the lock unless it is held by a blocked process. (In the latter case an explicit wait for the hardware lock would cause a deadlock, which is why the "idlelock" was invented).

This should be sufficient to wait for GPU idle without having to worry about starvation.

Definition at line 328 of file drm_lock.c.

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

Lock ioctl.

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

Add the current task to the lock wait queue, and attempt to take to lock.

Definition at line 54 of file drm_lock.c.

int drm_lock_free ( struct drm_lock_data *  lock_data,
unsigned int  context 
)

Free lock.

Parameters
devDRM device.
locklock.
contextcontext.

Resets the lock file pointer. Marks the lock as not held, via the cmpxchg instruction. Wakes any task waiting on the lock queue.

Definition at line 255 of file drm_lock.c.

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

Unlock ioctl.

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

Transfer and free the lock.

Definition at line 149 of file drm_lock.c.

EXPORT_SYMBOL ( drm_idlelock_take  )
EXPORT_SYMBOL ( drm_idlelock_release  )