[intel-gem] Add explicit throttle ioctl
authorKeith Packard <keithp@keithp.com>
Fri, 6 Jun 2008 19:57:01 +0000 (12:57 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 6 Jun 2008 20:00:46 +0000 (13:00 -0700)
Instead of throttling and execbuffer time, have the application ask to
throttle explicitly. This allows the throttle to happen less often, and
without holding the DRM lock.

linux-core/i915_gem.c
shared-core/i915_dma.c
shared-core/i915_drm.h
shared-core/i915_drv.h

index 268411e8953809acac9d96c5f21c7c1a306fee8d..14e57b41c2ca3093db1ca71f7b36db4f90ae3b79 100644 (file)
@@ -1371,10 +1371,6 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
 #endif
        i915_kernel_lost_context(dev);
 
-       ret = i915_gem_ring_throttle(dev);
-       if (ret)
-               return ret;
-
        /* Copy in the exec list from userland */
        exec_list = drm_calloc(sizeof(*exec_list), args->buffer_count,
                               DRM_MEM_DRIVER);
@@ -1628,6 +1624,13 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
        return 0;
 }
 
+int
+i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
+                       struct drm_file *file_priv)
+{
+    return i915_gem_ring_throttle(dev);
+}
+
 int i915_gem_init_object(struct drm_gem_object *obj)
 {
        struct drm_i915_gem_object *obj_priv;
index 1ea5c28ea0c67f861d5ba3816549e119221229f5..6e188f08bbe49aa56ca61bd021e2381d960d07d8 100644 (file)
@@ -1189,6 +1189,7 @@ struct drm_ioctl_desc i915_ioctls[] = {
        DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY),
        DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY),
        DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH),
+       DRM_IOCTL_DEF(DRM_I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH),
 };
 
 int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
index 4712ea4f4aec98fb17ece8b2a9a4a4360c1fd586..0fa292d0b77dcdf94e106af85cd0d6565165102a 100644 (file)
@@ -181,6 +181,7 @@ typedef struct drm_i915_sarea {
 #define DRM_I915_GEM_PIN       0x15
 #define DRM_I915_GEM_UNPIN     0x16
 #define DRM_I915_GEM_BUSY      0x17
+#define DRM_I915_GEM_THROTTLE  0x18
 
 #define DRM_IOCTL_I915_INIT            DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
 #define DRM_IOCTL_I915_FLUSH           DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -205,6 +206,7 @@ typedef struct drm_i915_sarea {
 #define DRM_IOCTL_I915_GEM_PIN         DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
 #define DRM_IOCTL_I915_GEM_UNPIN       DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
 #define DRM_IOCTL_I915_GEM_BUSY                DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
+#define DRM_IOCTL_I915_GEM_THROTTLE    DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
 
 /* Asynchronous page flipping:
  */
index d646177b01d2a1bf28b9190a6c9ebc007114f2ab..33fb7ca9562961012f0d7e8ece032392166a5cc7 100644 (file)
@@ -451,6 +451,8 @@ int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
                         struct drm_file *file_priv);
 int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
                        struct drm_file *file_priv);
+int i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
+                           struct drm_file *file_priv);
 int i915_gem_init_object(struct drm_gem_object *obj);
 void i915_gem_free_object(struct drm_gem_object *obj);
 int i915_gem_set_domain(struct drm_gem_object *obj,