[intel-gem] Use a delayed_work instead of a timer + work_struct
authorKeith Packard <keithp@keithp.com>
Fri, 13 Jun 2008 16:19:30 +0000 (09:19 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 13 Jun 2008 21:29:46 +0000 (14:29 -0700)
We want request retirement to occur about once a second when the request
queue is non-empty. This was done with a timer that queued a work_struct,
using a delayed_work instead makes a lot more sense.

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

index a14781f6d3df23b3dbd8212a6f9f251b148ef37c..115f8e75a9f0727babc77477e8ab71300fee2339 100644 (file)
@@ -503,28 +503,19 @@ i915_gem_retire_requests(struct drm_device *dev)
 }
 
 void
-i915_gem_retire_timeout(unsigned long data)
-{
-       struct drm_device *dev = (struct drm_device *) data;
-       drm_i915_private_t *dev_priv = dev->dev_private;
-
-       schedule_work(&dev_priv->mm.retire_task);
-}
-
-void
-i915_gem_retire_handler(struct work_struct *work)
+i915_gem_retire_work_handler(struct work_struct *work)
 {
        drm_i915_private_t *dev_priv;
        struct drm_device *dev;
 
        dev_priv = container_of(work, drm_i915_private_t,
-                               mm.retire_task);
+                               mm.retire_work.work);
        dev = dev_priv->dev;
 
        mutex_lock(&dev->struct_mutex);
        i915_gem_retire_requests(dev);
        if (!list_empty(&dev_priv->mm.request_list))
-               mod_timer(&dev_priv->mm.retire_timer, jiffies + HZ);
+               schedule_delayed_work (&dev_priv->mm.retire_work, HZ);
        mutex_unlock(&dev->struct_mutex);
 }
 
index 667a6ac0b6cff80a12ae4a4757ead72d57d2cc00..669f1e4e2afe71fa4912eadd51c6f2bbf52d3a24 100644 (file)
@@ -1072,11 +1072,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
        INIT_LIST_HEAD(&dev_priv->mm.flushing_list);
        INIT_LIST_HEAD(&dev_priv->mm.inactive_list);
        INIT_LIST_HEAD(&dev_priv->mm.request_list);
-       dev_priv->mm.retire_timer.function = i915_gem_retire_timeout;
-       dev_priv->mm.retire_timer.data = (unsigned long) dev;
-       init_timer_deferrable (&dev_priv->mm.retire_timer);
-       INIT_WORK(&dev_priv->mm.retire_task,
-                 i915_gem_retire_handler);
+       INIT_DELAYED_WORK(&dev_priv->mm.retire_work,
+                         i915_gem_retire_work_handler);
        dev_priv->mm.next_gem_seqno = 1;
 
 #ifdef __linux__
index 5af9a9649c29bc3d1438cdec62cb0e2d30dea5e4..5cc6e680bf0afcf0225baa1bb1b9ed757d202971 100644 (file)
@@ -285,8 +285,7 @@ typedef struct drm_i915_private {
                 * fire periodically while the ring is running. When it
                 * fires, go retire requests.
                 */
-               struct timer_list retire_timer;
-               struct work_struct retire_task;
+               struct delayed_work retire_work;
                
                uint32_t next_gem_seqno;
 
@@ -488,8 +487,7 @@ int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
 void i915_gem_object_unpin(struct drm_gem_object *obj);
 void i915_gem_lastclose(struct drm_device *dev);
 void i915_gem_retire_requests(struct drm_device *dev);
-void i915_gem_retire_timeout(unsigned long data);
-void i915_gem_retire_handler(struct work_struct *work);
+void i915_gem_retire_work_handler(struct work_struct *work);
 #endif
 
 #ifdef __linux__
@@ -915,6 +913,9 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 #define XY_SRC_COPY_BLT_SRC_TILED      (1<<15)
 #define XY_SRC_COPY_BLT_DST_TILED      (1<<11)
 
+#define MI_NOOP                        (0)
+#define  MI_NOOP_ENABLE_NOPID  (1 << 22)
+#define  MI_NOOP_ID_MASK       ((1 << 22) - 1)
 
 #define MI_BATCH_BUFFER                ((0x30<<23)|1)
 #define MI_BATCH_BUFFER_START  (0x31<<23)