summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-05-25 20:45:20 -0700
committerKeith Packard <keithp@keithp.com>2008-05-25 20:45:20 -0700
commit7cf3fd29fe058a0bfc2ba7e889d1b360398be161 (patch)
treee56ab8ca8c61b0b7f3c930d7111fbe733ebbe655 /linux-core
parent6d1d11704ab36e4ee50b2c1d3b984ab6bb691417 (diff)
[intel-gem] Add DRM_I915_GEM_BUSY ioctl to check for idle buffers.
This new ioctl returns whether re-using the buffer would force a wait.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/i915_gem.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c
index b5c87747..99dc00fc 100644
--- a/linux-core/i915_gem.c
+++ b/linux-core/i915_gem.c
@@ -1471,6 +1471,31 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
return 0;
}
+int
+i915_gem_busy_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv)
+{
+ struct drm_i915_gem_busy *args = data;
+ struct drm_gem_object *obj;
+ struct drm_i915_gem_object *obj_priv;
+
+ mutex_lock(&dev->struct_mutex);
+ obj = drm_gem_object_lookup(dev, file_priv, args->handle);
+ if (obj == NULL) {
+ DRM_ERROR("Bad handle in i915_gem_busy_ioctl(): %d\n",
+ args->handle);
+ mutex_unlock(&dev->struct_mutex);
+ return -EINVAL;
+ }
+
+ obj_priv = obj->driver_private;
+ args->busy = obj_priv->active;
+
+ drm_gem_object_unreference(obj);
+ mutex_unlock(&dev->struct_mutex);
+ return 0;
+}
+
int i915_gem_init_object(struct drm_gem_object *obj)
{
struct drm_i915_gem_object *obj_priv;