From patchwork Mon Jan 18 15:15:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kulkarni, Vandita" X-Patchwork-Id: 8053141 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65E5CBEEE5 for ; Mon, 18 Jan 2016 07:32:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8066420259 for ; Mon, 18 Jan 2016 07:32:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 942B220251 for ; Mon, 18 Jan 2016 07:32:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0852A6E3F7; Sun, 17 Jan 2016 23:32:23 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F4F36E3F7 for ; Sun, 17 Jan 2016 23:32:21 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 17 Jan 2016 23:32:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,311,1449561600"; d="scan'208";a="883721832" Received: from vandita-desktop.iind.intel.com ([10.223.26.11]) by fmsmga001.fm.intel.com with ESMTP; 17 Jan 2016 23:32:20 -0800 From: Vandita Kulkarni To: intel-gfx@lists.freedesktop.org Date: Mon, 18 Jan 2016 20:45:39 +0530 Message-Id: <1453130143-7228-6-git-send-email-vandita.kulkarni@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453130143-7228-1-git-send-email-vandita.kulkarni@intel.com> References: <1453130143-7228-1-git-send-email-vandita.kulkarni@intel.com> Subject: [Intel-gfx] [PATCH 5/9] drm/i915/skl: Add support for blending modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, 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: Damien Lespiau This patch adds support for blending modes involving color. Signed-off-by: Damien Lespiau --- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 12 +++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7e59a49..39e9db4 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11901,6 +11901,7 @@ static int intel_plane_state_check_blend(struct drm_plane_state *plane_state) state->premultiplied_alpha = false; state->drop_alpha = false; + state->use_plane_alpha = false; switch (mode->func) { /* @@ -11929,6 +11930,27 @@ static int intel_plane_state_check_blend(struct drm_plane_state *plane_state) if (!has_per_pixel_blending) return -EINVAL; break; + /* plane alpha */ + case DRM_BLEND_FUNC(CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA): + if (has_per_pixel_blending) + state->drop_alpha = true; + state->use_plane_alpha = true; + break; + /* plane alpha, pre-multiplied fb */ + case DRM_BLEND_FUNC(CONSTANT_ALPHA, + ONE_MINUS_CONSTANT_ALPHA_TIMES_SRC_ALPHA): + if (!has_per_pixel_blending) + return -EINVAL; + state->premultiplied_alpha = true; + state->use_plane_alpha = true; + break; + /* plane alpha, non pre-multiplied fb */ + case DRM_BLEND_FUNC(CONSTANT_ALPHA_TIMES_SRC_ALPHA, + ONE_MINUS_CONSTANT_ALPHA_TIMES_SRC_ALPHA): + if (!has_per_pixel_blending) + return -EINVAL; + state->use_plane_alpha = true; + break; default: return -EINVAL; } @@ -14272,6 +14294,12 @@ void intel_plane_add_blend_properties(struct intel_plane *plane) if (prop) drm_object_attach_property(&plane->base.base, prop, DRM_BLEND_FUNC(AUTO, AUTO)); + + prop = dev->mode_config.prop_blend_color; + if (prop) + drm_object_attach_property(&plane->base.base, prop, + DRM_MODE_COLOR(0xffff, 0xffff, + 0xffff, 0xffff)); } static int diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index f99e1d9..8226c8e 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -299,6 +299,7 @@ struct intel_plane_state { */ bool premultiplied_alpha; /* is the fb pre-multiplied? */ bool drop_alpha; /* drop the fb alpha channel */ + bool use_plane_alpha; /* use per-plane alpha */ struct drm_intel_sprite_colorkey ckey; diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 9538658..9175152 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -227,12 +227,14 @@ skl_update_plane(struct drm_plane *drm_plane, crtc_w--; crtc_h--; - if (key->flags) { + I915_WRITE(PLANE_KEYMAX(pipe, plane), + (DRM_MODE_COLOR_ALPHA_8(plane_state->base.blend_mode.color) + << 24) | (key->max_value & 0x00ffffff)); + I915_WRITE(PLANE_KEYMSK(pipe, plane), + (plane_state->use_plane_alpha << 31) | + (key->channel_mask & GENMASK(0, 26))); + if (key->flags) I915_WRITE(PLANE_KEYVAL(pipe, plane), key->min_value); - I915_WRITE(PLANE_KEYMAX(pipe, plane), key->max_value); - I915_WRITE(PLANE_KEYMSK(pipe, plane), key->channel_mask); - } - if (key->flags & I915_SET_COLORKEY_DESTINATION) plane_ctl |= PLANE_CTL_KEY_ENABLE_DESTINATION; else if (key->flags & I915_SET_COLORKEY_SOURCE)