diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index f1bf0b0..59d616d 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -174,11 +174,17 @@ struct overlay_registers { #define OVERLAY_NONPHYSICAL(dev) (IS_G33(dev) || IS_I965G(dev)) #define OVERLAY_EXISTS(dev) (!IS_G4X(dev) && !IS_IGDNG(dev)) +static int overlay_map_counter; +#define OVERLAY_REGFILE_SIZE 0x100 +#define OVERLAY_REGFILE_START 0x30100 static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_overlay *overlay) { drm_i915_private_t *dev_priv = overlay->dev->dev_private; struct overlay_registers *regs; + unsigned int i, bad = 0; + u32 val, *m_reg; + /* no recursive mappings */ BUG_ON(overlay->virt_addr); @@ -194,6 +200,30 @@ static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_over } else regs = overlay->reg_bo->phys_obj->handle->vaddr; + /* cludge to work around the first map */ + if (overlay_map_counter < 2) + goto out; + + m_reg = (u32 *) regs; + for (i = 0; i < OVERLAY_REGFILE_SIZE; i += 4) { + val = I915_READ(OVERLAY_REGFILE_START + i); + if (val != m_reg[i/4]) { + bad = 1; + printk("0x%04x value doesn't match (0x%x != 0x%x)\n", + i, val, m_reg[i/4]); + } + } + + if (bad) + printk("inconsistent overlay regs in mapping %i\n", + overlay_map_counter); + else + printk("consistent overlay regs in mapping %i\n", + overlay_map_counter); + +out: + overlay_map_counter++; + return overlay->virt_addr = regs; } @@ -851,6 +881,8 @@ int intel_overlay_switch_off(struct intel_overlay *overlay) regs->OCMD = 0; intel_overlay_unmap_regs_atomic(overlay); + printk("switching overlay off: inconsistent regs expected\n"); + ret = intel_overlay_off(overlay); if (ret != 0) return ret; @@ -1304,6 +1336,8 @@ int intel_overlay_attrs(struct drm_device *dev, void *data, intel_overlay_unmap_regs_atomic(overlay); + printk("async attribute update: overlay inconsistency expected\n"); + if (attrs->flags & I915_OVERLAY_UPDATE_GAMMA) { if (!IS_I9XX(dev)) { ret = -EINVAL;