[intel-gem] Use a delayed_work instead of a timer + work_struct

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.
main
Keith Packard 2008-06-13 09:19:30 -07:00
parent e5364914ac
commit 462af73149
3 changed files with 10 additions and 21 deletions

View 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);
}

View 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__

View 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)