From patchwork Tue Sep 9 06:23:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 4866111 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 33609C0338 for ; Tue, 9 Sep 2014 06:18:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B3BB200D0 for ; Tue, 9 Sep 2014 06:18:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DF3392015D for ; Tue, 9 Sep 2014 06:18:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 719D06E388; Mon, 8 Sep 2014 23:18:13 -0700 (PDT) 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 4F9916E388 for ; Mon, 8 Sep 2014 23:18:12 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by orsmga102.jf.intel.com with ESMTP; 08 Sep 2014 23:12:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,491,1406617200"; d="scan'208";a="476245647" Received: from shashanks-desktop.iind.intel.com ([10.223.26.11]) by azsmga001.ch.intel.com with ESMTP; 08 Sep 2014 23:18:08 -0700 From: shashank.sharma@intel.com To: intel-gfx@lists.freedesktop.org, matthew.d.roper@intel.com, sonika.jindal@intel.com Date: Tue, 9 Sep 2014 11:53:13 +0530 Message-Id: <1410243796-11172-2-git-send-email-shashank.sharma@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410243796-11172-1-git-send-email-shashank.sharma@intel.com> References: <20140726015853.GA8878@intel.com> <1410243796-11172-1-git-send-email-shashank.sharma@intel.com> MIME-Version: 1.0 Cc: daniel.vetter@intel.com Subject: [Intel-gfx] [PATCH 1/4] drm/i915: Color manager framework for valleyview X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-6.7 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 From: Shashank Sharma Color manager is a framework which adds drm properties for color correction in I915 driver. This framework creates DRM properties for each color correction feature, and attaches it to appropriate CRTC/plane based on the property type. This allows userspace to fine tune the display as per the panel. This is the first patch of the series, what this patch does is: 1. Create 2 new files intel_clrmgr.c intel_clrmgr.h 2. Add color manager init function, This function will create DRM properties for color correction. 3. Add color manager exit function. This function will destroy registered DRM color properties. 4. Adds a enum for currently listed color correction properties: they are: CSC correction (wide gamut), Gamma correction, Contrast, Brightness, Hue and Saturation This enum will be further used to index color properties from array of elements. 5. Add names for vlv color properties. Signed-off-by: Shashank Sharma --- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_clrmgr.c | 80 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_clrmgr.h | 70 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 5 +++ 4 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_clrmgr.c create mode 100644 drivers/gpu/drm/i915/intel_clrmgr.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index c1dd485..6361c9b 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -46,7 +46,8 @@ i915-y += intel_bios.o \ intel_modes.o \ intel_overlay.o \ intel_sideband.o \ - intel_sprite.o + intel_sprite.o \ + intel_clrmgr.o i915-$(CONFIG_ACPI) += intel_acpi.o intel_opregion.o i915-$(CONFIG_DRM_I915_FBDEV) += intel_fbdev.o diff --git a/drivers/gpu/drm/i915/intel_clrmgr.c b/drivers/gpu/drm/i915/intel_clrmgr.c new file mode 100644 index 0000000..0def917 --- /dev/null +++ b/drivers/gpu/drm/i915/intel_clrmgr.c @@ -0,0 +1,80 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * ====== + * Shashank Sharma + * Uma Shankar + * Sonika Jindal + */ + +#include "i915_drm.h" +#include "i915_drv.h" +#include "i915_reg.h" +#include "intel_clrmgr.h" + +/* Names to register with color properties */ +const char *clrmgr_property_names[] = { + /* csc */ + "csc-correction", + /* gamma */ + "gamma-correction", + /* contrast */ + "contrast", + /* brightness */ + "brightness", + /* hue_saturation */ + "hue_saturation" + /* add a new prop name here */ +}; + +int intel_clrmgr_create_color_properties(struct drm_device *dev) +{ + DRM_DEBUG_DRIVER("\n"); + return 0; +} + +void intel_clrmgr_destroy_color_properties(struct drm_device *dev) +{ + DRM_DEBUG_DRIVER("\n"); +} + +void intel_clrmgr_init(struct drm_device *dev) +{ + int ret; + + /* Create color properties */ + ret = intel_clrmgr_create_color_properties(dev); + if (ret) { + DRM_ERROR("Unable to create %d propert%s\n", + ret, ret > 1 ? "ies" : "y"); + return; + } + DRM_DEBUG_DRIVER("Successfully created color properties\n"); +} + +void intel_clrmgr_exit(struct drm_device *dev) +{ + /* Remove color properties */ + intel_clrmgr_destroy_color_properties(dev); + DRM_DEBUG_DRIVER("Destroyed color properties\n"); +} diff --git a/drivers/gpu/drm/i915/intel_clrmgr.h b/drivers/gpu/drm/i915/intel_clrmgr.h new file mode 100644 index 0000000..1b7e906 --- /dev/null +++ b/drivers/gpu/drm/i915/intel_clrmgr.h @@ -0,0 +1,70 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * ===== + * Shashank Sharma + * Uma Shankar + * Sonika Jindal + */ + +#ifndef _I915_CLR_MNGR_H_ +#define _I915_CLR_MNGR_H_ + +#include "drmP.h" +#include "intel_drv.h" +#include + +/* Framework defs */ +#define CLRMGR_PROP_MAX 10 +#define CLRMGR_PROP_NAME_MAX 128 +#define CLRMGR_PROP_RANGE_MAX 0xFFFFFFFFFFFFFFFF + +/* Properties */ +enum clrmgr_tweaks { + csc = 0, + gamma, + contrast, + brightness, + hue_saturation, + clrmgr_tweak_invalid +}; + +/* +* intel_clrmgr_init: +* Create drm properties for color correction +* Allocate memory to store current color correction +* input: struct drm_device * +*/ +void intel_clrmgr_init(struct drm_device *dev); + +/* +* intel_clrmgr_exit +* Destroy color correction DRM properties +* Free allocated memory for color correction storage +* Should be called from CRTC/Plane .destroy function +* input: +* struct drm_device * +*/ +void intel_clrmgr_exit(struct drm_device *dev); + +#endif diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e0beaad..df2dcbd 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -42,6 +42,7 @@ #include #include #include +#include "intel_clrmgr.h" /* Primary plane formats supported by all gen */ #define COMMON_PRIMARY_FORMATS \ @@ -12816,6 +12817,8 @@ void intel_modeset_init(struct drm_device *dev) INTEL_INFO(dev)->num_pipes, INTEL_INFO(dev)->num_pipes > 1 ? "s" : ""); + intel_clrmgr_init(dev); + for_each_pipe(dev_priv, pipe) { intel_crtc_init(dev, pipe); for_each_sprite(pipe, sprite) { @@ -13349,6 +13352,8 @@ void intel_modeset_cleanup(struct drm_device *dev) intel_connector->unregister(intel_connector); } + intel_clrmgr_exit(dev); + drm_mode_config_cleanup(dev); intel_cleanup_overlay(dev);