And implement it on ValleyView. Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org> --- 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 ce3e6f4..fd55b20 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3266,6 +3266,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 74864a1..9563df8 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -171,7 +171,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); @@ -180,8 +181,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; -- 1.7.9.5