From patchwork Thu Feb 27 16:38:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paauwe, Bob J" X-Patchwork-Id: 3734591 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 D969B9F35F for ; Thu, 27 Feb 2014 16:38:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01D04201FE for ; Thu, 27 Feb 2014 16:38:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 024DD201BA for ; Thu, 27 Feb 2014 16:38:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B586FB810; Thu, 27 Feb 2014 08:38:12 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id AD1C9FB80E for ; Thu, 27 Feb 2014 08:37:56 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 27 Feb 2014 08:37:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,555,1389772800"; d="scan'208";a="489336831" Received: from bpaauwe-desk.fm.intel.com ([10.1.134.207]) by fmsmga002.fm.intel.com with ESMTP; 27 Feb 2014 08:37:52 -0800 From: Bob Paauwe To: intel-gfx Date: Thu, 27 Feb 2014 08:38:14 -0800 Message-Id: <1393519094-8659-3-git-send-email-bob.j.paauwe@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1393519094-8659-1-git-send-email-bob.j.paauwe@intel.com> References: <1393519094-8659-1-git-send-email-bob.j.paauwe@intel.com> Subject: [Intel-gfx] [PATCH 2/2] Add gamma property to sprite planes. 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.2 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 Add a gamma property to sprite planes that enables/disables the gamma ramp on sprite planes. By default the gamma ramp is enabled to match the prior behavior. v2: Rename property variable from "gamma" to "gamma_property" for clarity Change property type from range to enum (Matt) Add enum definitions for sprite gamma enable/disable v3: Rename property name to "Sprite Gamma Enabled" (Matt) Signed-off-by: Bob Paauwe --- drivers/gpu/drm/i915/i915_drv.h | 5 +++++ drivers/gpu/drm/i915/intel_drv.h | 6 ++++++ drivers/gpu/drm/i915/intel_sprite.c | 28 ++++++++++++++++++++++------ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 8c64831..69934be 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2671,6 +2671,11 @@ void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine); #define INTEL_BROADCAST_RGB_FULL 1 #define INTEL_BROADCAST_RGB_LIMITED 2 +/* Sprite plane "Sprite Gamma" property */ +#define INTEL_GAMMA_DISABLED 0 +#define INTEL_GAMMA_ENABLED 1 + + static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev) { if (HAS_PCH_SPLIT(dev)) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index a4ffc02..7d72c49 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -406,6 +406,12 @@ struct intel_plane { uint32_t src_x, src_y; uint32_t src_w, src_h; + struct { + struct drm_property *gamma_property; + } properties; + + bool gamma; + /* Since we need to change the watermarks before/after * enabling/disabling the planes, we need to store the parameters here * as the other pieces of the struct may not reflect the values we want diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index f9f81dd..d2173da 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -37,6 +37,7 @@ #include #include "i915_drv.h" + static void vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, struct drm_framebuffer *fb, @@ -106,9 +107,8 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, /* * Enable gamma to match primary/cursor plane behaviour. - * FIXME should be user controllable via propertiesa. */ - sprctl |= SP_GAMMA_ENABLE; + sprctl |= (intel_plane->gamma) ? SP_GAMMA_ENABLE : 0; if (obj->tiling_mode != I915_TILING_NONE) sprctl |= SP_TILED; @@ -264,9 +264,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, /* * Enable gamma to match primary/cursor plane behaviour. - * FIXME should be user controllable via propertiesa. */ - sprctl |= SPRITE_GAMMA_ENABLE; + sprctl |= (intel_plane->gamma) ? SPRITE_GAMMA_ENABLE : 0; if (obj->tiling_mode != I915_TILING_NONE) sprctl |= SPRITE_TILED; @@ -448,9 +447,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, /* * Enable gamma to match primary/cursor plane behaviour. - * FIXME should be user controllable via propertiesa. */ - dvscntr |= DVS_GAMMA_ENABLE; + dvscntr |= (intel_plane->gamma) ? DVS_GAMMA_ENABLE : 0; if (obj->tiling_mode != I915_TILING_NONE) dvscntr |= DVS_TILED; @@ -953,6 +951,11 @@ static int intel_set_property(struct drm_plane *plane, struct drm_property *property, uint64_t value) { + struct intel_plane *intel_plane = to_intel_plane(plane); + + if (property == intel_plane->properties.gamma_property) + intel_plane->gamma = (bool)value; + return 0; } @@ -1079,6 +1082,11 @@ static uint32_t vlv_plane_formats[] = { DRM_FORMAT_VYUY, }; +static const struct drm_prop_enum_list intel_gamma_enum_list[] = { + { INTEL_GAMMA_DISABLED, "Off" }, + { INTEL_GAMMA_ENABLED, "On" } +}; + int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) { @@ -1158,5 +1166,13 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) if (ret) kfree(intel_plane); + /* Initialize the plane properties */ + intel_plane->properties.gamma_property = + drm_property_create_enum(dev, 0, "Sprite Gamma Enabled", + intel_gamma_enum_list, ARRAY_SIZE(intel_gamma_enum_list)); + intel_plane->gamma = true; + drm_object_attach_property(&intel_plane->base.base, + intel_plane->properties.gamma_property, intel_plane->gamma); + return ret; }