From patchwork Fri Mar 8 18:45:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 2239931 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 15CEDDF215 for ; Fri, 8 Mar 2013 18:46:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E0EDCE5F05 for ; Fri, 8 Mar 2013 10:46:54 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy12-pub.bluehost.com (oproxy12-pub.bluehost.com [50.87.16.10]) by gabe.freedesktop.org (Postfix) with SMTP id 1A76CE5EC5 for ; Fri, 8 Mar 2013 10:46:09 -0800 (PST) Received: (qmail 16494 invoked by uid 0); 8 Mar 2013 18:46:08 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy12.bluehost.com with SMTP; 8 Mar 2013 18:46:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=3++IAqSugyPYZonBMblY18OsPVsef8gpDLEOEATdtSc=; b=sHNhM68dEAasrv0jWur4bf8zcKtBo/cvxnQdmonew7Exf/TjVIIAWJrb+9807z9CV5FbUJ3aA8a4jj9duLRJMPdgavy1O0oOo8fdl3pJOTKjnTTaZ25DSSsFGrHyKTdk; Received: from [67.161.37.189] (port=54362 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1UE2Iw-0007SY-UR for intel-gfx@lists.freedesktop.org; Fri, 08 Mar 2013 11:46:07 -0700 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Fri, 8 Mar 2013 10:45:46 -0800 Message-Id: <1362768363-3710-3-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362768363-3710-1-git-send-email-jbarnes@virtuousgeek.org> References: <1362768363-3710-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 03/20] drm/i915: add constant alpha support to sprite ioctl 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+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org And implement it on ValleyView. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 11 ++++++++++- include/uapi/drm/i915_drm.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 669a61c..6a7e424 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3287,6 +3287,7 @@ #define _SPAKEYMAXVAL 0x721a0 #define _SPATILEOFF 0x721a4 #define _SPACONSTALPHA 0x721a8 +#define SP_ALPHA_EN (1<<31) #define _SPAGAMC 0x721f4 #define _SPBCNTR 0x72280 diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 26fee2f..a6a49f6 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -162,7 +162,8 @@ vlv_update_colorkey(struct drm_plane *dplane, int plane = intel_plane->plane; u32 sprctl; - if (key->flags & I915_SET_COLORKEY_DESTINATION) + if (!(key->flags & + (I915_SET_COLORKEY_SOURCE | I915_SET_COLORKEY_ALPHA))) return -EINVAL; I915_WRITE(SPKEYMINVAL(pipe, plane), key->min_value); @@ -171,8 +172,16 @@ vlv_update_colorkey(struct drm_plane *dplane, sprctl = I915_READ(SPCNTR(pipe, plane)); sprctl &= ~SP_SOURCE_KEY; + + if (!(key->flags & I915_SET_COLORKEY_ALPHA)) + I915_WRITE(SPCONSTALPHA(pipe, plane), 0); + if (key->flags & I915_SET_COLORKEY_SOURCE) sprctl |= SP_SOURCE_KEY; + else if (key->flags & I915_SET_COLORKEY_ALPHA) { + I915_WRITE(SPCONSTALPHA(pipe, plane), + SP_ALPHA_EN | key->channel_mask); + } I915_WRITE(SPCNTR(pipe, plane), sprctl); POSTING_READ(SPKEYMSK(pipe, plane)); diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index 07d5941..05e61bc 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -949,6 +949,7 @@ struct drm_intel_overlay_attrs { #define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */ #define I915_SET_COLORKEY_DESTINATION (1<<1) #define I915_SET_COLORKEY_SOURCE (1<<2) +#define I915_SET_COLORKEY_ALPHA (1<<3) struct drm_intel_sprite_colorkey { __u32 plane_id; __u32 min_value;