From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 03/20] drm/i915: add constant alpha support to sprite ioctl Date: Tue, 19 Mar 2013 09:42:56 +0100 Message-ID: <20130319084255.GW9021@phenom.ffwll.local> References: <1362768363-3710-1-git-send-email-jbarnes@virtuousgeek.org> <1362768363-3710-3-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E5CAE5EC7 for ; Tue, 19 Mar 2013 01:40:10 -0700 (PDT) Received: by mail-ee0-f48.google.com with SMTP id t10so94884eei.35 for ; Tue, 19 Mar 2013 01:40:09 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1362768363-3710-3-git-send-email-jbarnes@virtuousgeek.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Jesse Barnes Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Mar 08, 2013 at 10:45:46AM -0800, Jesse Barnes wrote: > 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) We've added this driver-private ioctl before attributes everywhere was possible. I think we need to convert that before adding more stuff ... Also some discussion on dri-devel about a somewhat standardized set of plane blending properties can't hurt. Yes, I know that this will lead to a massive dri-devel bikeshed ;-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch