[Intel-gfx] [PATCH 5/6] drm/i915: Color manager: hue/saturation correction
Shashank Sharma
shashank.sharma at intel.com
Thu Feb 20 13:37:26 CET 2014
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 <shashank.sharma at intel.com>
---
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)
--
1.7.10.4
More information about the Intel-gfx
mailing list