From patchwork Thu Oct 18 09:49:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1609571 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id A1FD7DFB34 for ; Thu, 18 Oct 2012 10:14:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9326FA0A04 for ; Thu, 18 Oct 2012 03:14:45 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 39DCF9E880 for ; Thu, 18 Oct 2012 02:32:07 -0700 (PDT) Received: by mail-ea0-f177.google.com with SMTP id n13so2055073eaa.36 for ; Thu, 18 Oct 2012 02:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=O5NnyTPHmjQmDnmTgRGdbWKhOxgNkQdfU+RFmT9vLi8=; b=EZ3SbWQjtjfIxmf2grAQ/yuO9Hd4kS+XffrA0VVW+Fw3ScRRVebnAsnDZFnloyYtAa okxgd34o119yE1DN7tWmjTkI10hPOhVkGCSAszblJCCaTy7HJHUj4h5EJmw1JP1zP0XX hZ+f+zfe9alPwhqu2sfCMPAJRxK6BQyEliTvg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=O5NnyTPHmjQmDnmTgRGdbWKhOxgNkQdfU+RFmT9vLi8=; b=lT0Z22UqccwL5mgNMBx62xpR17RBJ3z5qyaz2HNizGbLEHZHZroSoLdzKmu8Ji+RYz EcqtsDDk/awAdds7aT1KtYQRA9AAM6TrjRUAECq7T0uxw9E0OVFUuuG+CfZFBSpIMAJW 6rxfh6j8ijyDRD4lxXhZ4GAFLiWB4i3cFbudtsY6rpd0NO+Rd82JFKgXSTwCuvz7ZHLY KFME/7v/uDt/u0oe96s77gECuDpLV3S/X0E5V70dSO+NRS/uYmBMMfidrH20Pnl8C5kJ ftis6Wb/m0/cJZwiXyf2c+nRhFMIepmj0uXVVb5SqduB+/qyPar4VLuTAJYXNfjNg9Pn XhPw== Received: by 10.14.203.132 with SMTP id f4mr7101859eeo.11.1350552726855; Thu, 18 Oct 2012 02:32:06 -0700 (PDT) Received: from hummel.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id k2sm6200817eep.15.2012.10.18.02.32.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 02:32:06 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 18 Oct 2012 11:49:53 +0200 Message-Id: <1350553794-5534-5-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1350553794-5534-1-git-send-email-daniel.vetter@ffwll.ch> References: <1350553794-5534-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmwSFQLRdF2VAXP/EibCeD+I2l9XWndxke6r0k9+QHaRA1+jLaj8ihiGq66q9W+gUjdkaoy Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 4/5] drm/i915: implement WaDisableSpriteDestColorKey X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Unfortunately this requires a bit of book-keeping to return the right values for get_colorkey and to set things up correctly when re-enabling the plane. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_sprite.c | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 79f8ed6..e935e75 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -220,6 +220,8 @@ struct intel_plane { struct drm_i915_gem_object *obj; int max_downscale; u32 lut_r[1024], lut_g[1024], lut_b[1024]; + bool restore_ilk_dest_key; /* for a w/a */ + void (*update_plane)(struct drm_plane *plane, struct drm_framebuffer *fb, struct drm_i915_gem_object *obj, diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 7644f31..8bcacd5 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -230,6 +230,13 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, dvscntr = I915_READ(DVSCNTR(pipe)); + WARN_ON(!(dvscntr & DVS_ENABLE) && (dvscntr && DVS_DEST_KEY)); + + if (intel_plane->restore_ilk_dest_key) { + dvscntr |= DVS_DEST_KEY; + intel_plane->restore_ilk_dest_key = false; + } + /* Mask out pixel format bits in case we change it */ dvscntr &= ~DVS_PIXFORMAT_MASK; dvscntr &= ~DVS_RGB_ORDER_XBGR; @@ -311,8 +318,16 @@ ilk_disable_plane(struct drm_plane *plane) struct drm_i915_private *dev_priv = dev->dev_private; struct intel_plane *intel_plane = to_intel_plane(plane); int pipe = intel_plane->pipe; + uint32_t tmp; - I915_WRITE(DVSCNTR(pipe), I915_READ(DVSCNTR(pipe)) & ~DVS_ENABLE); + /* WaDisableSpriteDestColorKey: We need to disable the dest key when + * disabling the sprite. */ + tmp = I915_READ(DVSCNTR(pipe)); + if (IS_GEN5(dev) &&(tmp & DVS_DEST_KEY)) + intel_plane->restore_ilk_dest_key = true; + tmp &= ~(DVS_ENABLE | DVS_DEST_KEY); + + I915_WRITE(DVSCNTR(pipe), tmp); /* Disable the scaler */ I915_WRITE(DVSSCALE(pipe), 0); /* Flush double buffered register updates */ @@ -365,6 +380,7 @@ ilk_update_colorkey(struct drm_plane *plane, int ret = 0; intel_plane = to_intel_plane(plane); + intel_plane->restore_ilk_dest_key = false; I915_WRITE(DVSKEYVAL(intel_plane->pipe), key->min_value); I915_WRITE(DVSKEYMAX(intel_plane->pipe), key->max_value); @@ -372,9 +388,12 @@ ilk_update_colorkey(struct drm_plane *plane, dvscntr = I915_READ(DVSCNTR(intel_plane->pipe)); dvscntr &= ~(DVS_SOURCE_KEY | DVS_DEST_KEY); - if (key->flags & I915_SET_COLORKEY_DESTINATION) - dvscntr |= DVS_DEST_KEY; - else if (key->flags & I915_SET_COLORKEY_SOURCE) + if (key->flags & I915_SET_COLORKEY_DESTINATION) { + if ((dvscntr & DVS_ENABLE) || !IS_GEN5(dev)) + dvscntr |= DVS_DEST_KEY; + else + intel_plane->restore_ilk_dest_key = true; + } else if (key->flags & I915_SET_COLORKEY_SOURCE) dvscntr |= DVS_SOURCE_KEY; I915_WRITE(DVSCNTR(intel_plane->pipe), dvscntr);