i915: Fix handling of breadcrumb counter wraparounds.
parent
84bea38353
commit
3d5d41fa98
|
@ -41,9 +41,9 @@ static struct pci_device_id pciidlist[] = {
|
||||||
#ifdef I915_HAVE_FENCE
|
#ifdef I915_HAVE_FENCE
|
||||||
static drm_fence_driver_t i915_fence_driver = {
|
static drm_fence_driver_t i915_fence_driver = {
|
||||||
.num_classes = 1,
|
.num_classes = 1,
|
||||||
.wrap_diff = (1 << 30),
|
.wrap_diff = (1U << (BREADCRUMB_BITS - 1)),
|
||||||
.flush_diff = (1 << 29),
|
.flush_diff = (1U << (BREADCRUMB_BITS - 2)),
|
||||||
.sequence_mask = 0x7fffffffU,
|
.sequence_mask = BREADCRUMB_MASK,
|
||||||
.lazy_capable = 1,
|
.lazy_capable = 1,
|
||||||
.emit = i915_fence_emit_sequence,
|
.emit = i915_fence_emit_sequence,
|
||||||
.poke_flush = i915_poke_flush,
|
.poke_flush = i915_poke_flush,
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void i915_perform_flush(drm_device_t * dev)
|
||||||
* First update fences with the current breadcrumb.
|
* First update fences with the current breadcrumb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
diff = sequence - fc->last_exe_flush;
|
diff = (sequence - fc->last_exe_flush) & BREADCRUMB_MASK;
|
||||||
if (diff < driver->wrap_diff && diff != 0) {
|
if (diff < driver->wrap_diff && diff != 0) {
|
||||||
drm_fence_handler(dev, 0, sequence, DRM_FENCE_TYPE_EXE);
|
drm_fence_handler(dev, 0, sequence, DRM_FENCE_TYPE_EXE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,10 +445,12 @@ void i915_emit_breadcrumb(drm_device_t *dev)
|
||||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||||
RING_LOCALS;
|
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;
|
||||||
dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1;
|
|
||||||
|
|
||||||
BEGIN_LP_RING(4);
|
BEGIN_LP_RING(4);
|
||||||
OUT_RING(CMD_STORE_DWORD_IDX);
|
OUT_RING(CMD_STORE_DWORD_IDX);
|
||||||
|
|
|
@ -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 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_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])
|
#define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg])
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue