Logo Search packages:      
Sourcecode: linux version File versions  Download package

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 344 of file drm_lock.c.

References drm_lock_take().

Referenced by drm_release().

{
      int ret = 0;

      spin_lock(&lock_data->spinlock);
      lock_data->kernel_waiters++;
      if (!lock_data->idle_has_lock) {

            spin_unlock(&lock_data->spinlock);
            ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT);
            spin_lock(&lock_data->spinlock);

            if (ret == 1)
                  lock_data->idle_has_lock = 1;
      }
      spin_unlock(&lock_data->spinlock);
}


Generated by  Doxygen 1.6.0   Back to index