From 2ef75f974e0f7743983b893eefb5d0e92287ff4a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 20 Apr 2012 10:30:05 +0100 Subject: [PATCH] drm/i915/overlay: Fully configure overlay before turning on We seem to trigger an occasional error when the GPU tries to dereference a PTE for an overlay plane prior to us populating the offsets in the overlay registers. This is despite the Overlay Command being set to off. Close this window delaying the switch on until after those registers are initialised. References: https://bugs.freedesktop.org/show_bug.cgi?id=48939 Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_overlay.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 77d0fcc..b93ca30 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -205,6 +205,7 @@ intel_overlay_map_regs(struct intel_overlay *overlay) static void intel_overlay_unmap_regs(struct intel_overlay *overlay, struct overlay_registers *regs) { + readl(regs); /* flush all writes */ if (!OVERLAY_NEEDS_PHYSICAL(overlay->dev)) io_mapping_unmap(regs); } @@ -337,8 +338,6 @@ static int intel_overlay_continue(struct intel_overlay *overlay, u32 tmp; int ret; - BUG_ON(!overlay->active); - request = kzalloc(sizeof(*request), GFP_KERNEL); if (request == NULL) return -ENOMEM; @@ -781,24 +780,6 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, if (ret) goto out_unpin; - if (!overlay->active) { - regs = intel_overlay_map_regs(overlay); - if (!regs) { - ret = -ENOMEM; - goto out_unpin; - } - regs->OCONFIG = OCONF_CC_OUT_8BIT; - if (IS_GEN4(overlay->dev)) - regs->OCONFIG |= OCONF_CSC_MODE_BT709; - regs->OCONFIG |= overlay->crtc->pipe == 0 ? - OCONF_PIPE_A : OCONF_PIPE_B; - intel_overlay_unmap_regs(overlay, regs); - - ret = intel_overlay_on(overlay); - if (ret != 0) - goto out_unpin; - } - regs = intel_overlay_map_regs(overlay); if (!regs) { ret = -ENOMEM; @@ -842,9 +823,20 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, regs->OCMD = overlay_cmd_reg(params); + if (!overlay->active) { + regs->OCONFIG = OCONF_CC_OUT_8BIT; + if (IS_GEN4(overlay->dev)) + regs->OCONFIG |= OCONF_CSC_MODE_BT709; + regs->OCONFIG |= overlay->crtc->pipe == 0 ? + OCONF_PIPE_A : OCONF_PIPE_B; + } + intel_overlay_unmap_regs(overlay, regs); - ret = intel_overlay_continue(overlay, scale_changed); + if (!overlay->active) + ret = intel_overlay_on(overlay); + else + ret = intel_overlay_continue(overlay, scale_changed); if (ret) goto out_unpin; -- 1.7.10