From: Arun Siluvery Subject: [PATCH] drm/i915: Add means to apply WA conditionally Date: Thu, 23 Oct 2014 16:29:30 +0100 Message-ID: <1414078170-29469-1-git-send-email-arun.siluvery@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id E28296E01B for ; Thu, 23 Oct 2014 08:29:34 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org We would want to apply some of the workarounds based on a condition to a particular platform or Gen but we may not know all possible controlling parameters in advance hence allow to define open conditions; a WA makes it to the list only if the condition is true. With the appropriate conditions we can combine all of the workarounds and apply them from a single place irrespective of platform instead of having them in separate functions. For: VIZ-4090 Signed-off-by: Arun Siluvery --- drivers/gpu/drm/i915/intel_ringbuffer.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 497b836..0525a5d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -736,6 +736,41 @@ static int wa_add(struct drm_i915_private *dev_priv, #define WA_WRITE(addr, val) WA_REG(addr, val, 0xffffffff) +#define WA_SET_BIT_MASKED_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_SET_BIT_MASKED(addr, mask); \ + } \ + } while(0) + +#define WA_CLR_BIT_MASKED_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_CLR_BIT_MASKED(addr, mask); \ + } \ + } while(0) + +#define WA_SET_BIT_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_SET_BIT(addr, mask); \ + } \ + } while(0) + +#define WA_CLR_BIT_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_CLR_BIT(addr, mask); \ + } \ + } while(0) + +#define WA_WRITE_IF(cond, addr, val) \ + do { \ + if (cond) { \ + WA_WRITE(addr, val); \ + } \ + } while(0) + static int bdw_init_workarounds(struct intel_engine_cs *ring) { struct drm_device *dev = ring->dev; -- 2.1.2