From patchwork Thu Feb 20 12:37:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 3686841 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 510FA9F2EC for ; Thu, 20 Feb 2014 12:35:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 71BCA2018A for ; Thu, 20 Feb 2014 12:35:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8DA9820114 for ; Thu, 20 Feb 2014 12:35:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0733FB23D; Thu, 20 Feb 2014 04:35:08 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 67198F9ECB for ; Thu, 20 Feb 2014 04:34:51 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 20 Feb 2014 04:30:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,512,1389772800"; d="scan'208";a="486539111" Received: from shashanks-desktop.iind.intel.com ([10.223.25.92]) by orsmga002.jf.intel.com with ESMTP; 20 Feb 2014 04:34:48 -0800 From: Shashank Sharma To: intel-gfx@lists.freedesktop.org Date: Thu, 20 Feb 2014 18:07:26 +0530 Message-Id: <1392899847-2641-6-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1392899847-2641-1-git-send-email-shashank.sharma@intel.com> References: <1392899847-2641-1-git-send-email-shashank.sharma@intel.com> Cc: uma.shankar@intel.com Subject: [Intel-gfx] [PATCH 5/6] drm/i915: Color manager: hue/saturation correction 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@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is fourth extension to color manager framework. It adds implementataion of color manager property "Hue and Saturation correction" in intel color manager framework. Signed-off-by: Shashank Sharma --- drivers/gpu/drm/i915/intel_clrmgr.c | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_clrmgr.c b/drivers/gpu/drm/i915/intel_clrmgr.c index db13e2b..9d2203e 100644 --- a/drivers/gpu/drm/i915/intel_clrmgr.c +++ b/drivers/gpu/drm/i915/intel_clrmgr.c @@ -146,16 +146,100 @@ static bool is_sprite_enabled(struct drm_i915_private *dev_priv, return val & SP_ENABLE; } +/* Tune Hue Saturation Value for Sprite */ +int intel_sprite_hs_adjust(struct drm_device *dev, + struct hue_saturationlut *hs_ptr) +{ + drm_i915_private_t *dev_priv = dev->dev_private; + if (!dev_priv || !hs_ptr) { + DRM_ERROR("Hue Saturation: Invalid Arguments\n"); + return -EINVAL; + } + + switch (hs_ptr->sprite_no) { + /* Sprite plane */ + case sprite_a: + if (is_sprite_enabled(dev_priv, PIPE_A, SPRITE_PLANE_A)) + I915_WRITE(SPRITEA_HS_REG, hs_ptr->val); + break; + + case sprite_b: + if (is_sprite_enabled(dev_priv, PIPE_A, SPRITE_PLANE_B)) + I915_WRITE(SPRITEB_HS_REG, hs_ptr->val); + break; + + case sprite_c: + if (is_sprite_enabled(dev_priv, PIPE_B, SPRITE_PLANE_C)) + I915_WRITE(SPRITEC_HS_REG, hs_ptr->val); + break; + + case sprite_d: + if (is_sprite_enabled(dev_priv, PIPE_B, SPRITE_PLANE_D)) + I915_WRITE(SPRITED_HS_REG, hs_ptr->val); + break; + default: + DRM_ERROR("Invalid Sprite Number\n"); + return -EINVAL; + } + + return 0; +} + +/* +* Disable corrcetion for Hue/Saturation +* This is currently supported for Sprite planes only +*/ static bool intel_clrmgr_disable_hs(struct drm_device *dev, int identifier) { + struct hue_saturationlut hs; + drm_i915_private_t *dev_priv = dev->dev_private; + struct clrmgr_pipe_status *pstatus = dev_priv->clrmgr_status.pstatus; + + if (!pstatus) { + DRM_ERROR("Clrmgr: color manager not initialized"); + return false; + } + + hs.sprite_no = identifier; + hs.val = HS_DEFAULT_VAL; + + if (intel_sprite_hs_adjust(dev, &hs)) { + DRM_ERROR("\nClrmgr: Hue/Saturation disable failed"); + return false; + } + + pstatus->hs_enabled = false; return true; } +/* +* Enable corrcetion for Hue/Saturation +* This is currently supported for Sprite planes only +*/ static bool intel_clrmgr_enable_hs(struct drm_device *dev, int identifier) { + struct hue_saturationlut hs; + drm_i915_private_t *dev_priv = dev->dev_private; + struct clrmgr_pipe_status *pstatus = dev_priv->clrmgr_status.pstatus; + + if (!pstatus) { + DRM_ERROR("Clrmgr: color manager not initialized"); + return false; + } + + hs.sprite_no = identifier; + hs.val = clrmgr_luts[clrmgr_hs][CLR_MGR_PARSE_MIN-1]; + + if (intel_sprite_hs_adjust(dev, &hs)) { + DRM_ERROR("\nClrmgr: Hue/Saturation enable failed"); + return false; + } + + pstatus->hs_enabled = true; return true; } + /* Tune Contrast Brightness Value for Sprite */ int intel_sprite_cb_adjust(struct drm_device *dev, struct cont_brightlut *cb_ptr)