diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2010-02-19 05:51:59 -0500 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-02-26 16:23:21 -0500 |
commit | 63560396536e9eb8858826fcbfc14d4015a41a95 (patch) | |
tree | dad8f01fb791190a5361204f3ea98a54f941fcb7 /drivers/gpu/drm/i915 | |
parent | ae3db24aab398fb5f985696c12362eb12ef65812 (diff) |
drm/i915: ensure lru ordering of fence_list
The fence_list should be lru ordered for otherwise we might try
to steal a fence reg from an active object even though there are
fences from inactive objects available. lru ordering was obeyed
for gpu access everywhere save when moving dirty objects from
flushing_list to active_list.
Fixing this cause the code to indent way to much, so I've extracted
the flushing_list processing logic into its on function.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ce1c0262bc63..4b6d427ff7cd 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1558,6 +1558,38 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj) | |||
1558 | i915_verify_inactive(dev, __FILE__, __LINE__); | 1558 | i915_verify_inactive(dev, __FILE__, __LINE__); |
1559 | } | 1559 | } |
1560 | 1560 | ||
1561 | static void | ||
1562 | i915_gem_process_flushing_list(struct drm_device *dev, | ||
1563 | uint32_t flush_domains, uint32_t seqno) | ||
1564 | { | ||
1565 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1566 | struct drm_i915_gem_object *obj_priv, *next; | ||
1567 | |||
1568 | list_for_each_entry_safe(obj_priv, next, | ||
1569 | &dev_priv->mm.gpu_write_list, | ||
1570 | gpu_write_list) { | ||
1571 | struct drm_gem_object *obj = obj_priv->obj; | ||
1572 | |||
1573 | if ((obj->write_domain & flush_domains) == | ||
1574 | obj->write_domain) { | ||
1575 | uint32_t old_write_domain = obj->write_domain; | ||
1576 | |||
1577 | obj->write_domain = 0; | ||
1578 | list_del_init(&obj_priv->gpu_write_list); | ||
1579 | i915_gem_object_move_to_active(obj, seqno); | ||
1580 | |||
1581 | /* update the fence lru list */ | ||
1582 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | ||
1583 | list_move_tail(&obj_priv->fence_list, | ||
1584 | &dev_priv->mm.fence_list); | ||
1585 | |||
1586 | trace_i915_gem_object_change_domain(obj, | ||
1587 | obj->read_domains, | ||
1588 | old_write_domain); | ||
1589 | } | ||
1590 | } | ||
1591 | } | ||
1592 | |||
1561 | /** | 1593 | /** |
1562 | * Creates a new sequence number, emitting a write of it to the status page | 1594 | * Creates a new sequence number, emitting a write of it to the status page |
1563 | * plus an interrupt, which will trigger i915_user_interrupt_handler. | 1595 | * plus an interrupt, which will trigger i915_user_interrupt_handler. |
@@ -1616,29 +1648,8 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv, | |||
1616 | /* Associate any objects on the flushing list matching the write | 1648 | /* Associate any objects on the flushing list matching the write |
1617 | * domain we're flushing with our flush. | 1649 | * domain we're flushing with our flush. |
1618 | */ | 1650 | */ |
1619 | if (flush_domains != 0) { | 1651 | if (flush_domains != 0) |
1620 | struct drm_i915_gem_object *obj_priv, *next; | 1652 | i915_gem_process_flushing_list(dev, flush_domains, seqno); |
1621 | |||
1622 | list_for_each_entry_safe(obj_priv, next, | ||
1623 | &dev_priv->mm.gpu_write_list, | ||
1624 | gpu_write_list) { | ||
1625 | struct drm_gem_object *obj = obj_priv->obj; | ||
1626 | |||
1627 | if ((obj->write_domain & flush_domains) == | ||
1628 | obj->write_domain) { | ||
1629 | uint32_t old_write_domain = obj->write_domain; | ||
1630 | |||
1631 | obj->write_domain = 0; | ||
1632 | list_del_init(&obj_priv->gpu_write_list); | ||
1633 | i915_gem_object_move_to_active(obj, seqno); | ||
1634 | |||
1635 | trace_i915_gem_object_change_domain(obj, | ||
1636 | obj->read_domains, | ||
1637 | old_write_domain); | ||
1638 | } | ||
1639 | } | ||
1640 | |||
1641 | } | ||
1642 | 1653 | ||
1643 | if (!dev_priv->mm.suspended) { | 1654 | if (!dev_priv->mm.suspended) { |
1644 | mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD); | 1655 | mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD); |