diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-06-15 17:13:11 +0200 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-06-15 17:13:11 +0200 |
commit | 3d5d41fa9823cf44138c8f4bc954bca80539d74e (patch) | |
tree | 7f060a0348405663e8a9a00e26a90dcc58cf21b3 /shared-core | |
parent | 84bea383538df83c049680497ba2179e50d07ca3 (diff) |
i915: Fix handling of breadcrumb counter wraparounds.
Diffstat (limited to 'shared-core')
-rw-r--r-- | shared-core/i915_dma.c | 8 | ||||
-rw-r--r-- | shared-core/i915_drv.h | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index ebb184cc..dbc5f959 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -445,10 +445,12 @@ void i915_emit_breadcrumb(drm_device_t *dev) drm_i915_private_t *dev_priv = dev->dev_private; RING_LOCALS; - dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter; + if (++dev_priv->counter > BREADCRUMB_MASK) { + dev_priv->counter = 1; + DRM_DEBUG("Breadcrumb counter wrapped around\n"); + } - if (dev_priv->counter > 0x7FFFFFFFUL) - dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1; + dev_priv->sarea_priv->last_enqueue = dev_priv->counter; BEGIN_LP_RING(4); OUT_RING(CMD_STORE_DWORD_IDX); diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h index 9deee8ec..e0432996 100644 --- a/shared-core/i915_drv.h +++ b/shared-core/i915_drv.h @@ -363,6 +363,9 @@ extern int i915_wait_ring(drm_device_t * dev, int n, const char *caller); #define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) +#define BREADCRUMB_BITS 31 +#define BREADCRUMB_MASK ((1U << BREADCRUMB_BITS) - 1) + #define READ_BREADCRUMB(dev_priv) (((volatile u32*)(dev_priv->hw_status_page))[5]) #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg]) #endif |