hwc: Add support for plane alpha
HWC 1.2 API passes down the plane alpha and the blending
operation to apply. Pass this information to the MDP.
Change-Id: I7fbd17345d9157aa654e4b1031ac3e26adf87f37
diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h
index b543018..e49a50c 100644
--- a/liboverlay/overlayUtils.h
+++ b/liboverlay/overlayUtils.h
@@ -212,6 +212,8 @@
enum { MAX_PATH_LEN = 256 };
+enum { DEFAULT_PLANE_ALPHA = 0xFF };
+
/**
* Rotator flags: not to be confused with orientation flags.
* Usually, you want to open the rotator to make sure it is
@@ -329,21 +331,36 @@
OVERLAY_TRANSFORM_INV = 0x80
};
+enum eBlending {
+ OVERLAY_BLENDING_UNDEFINED = 0x0,
+ /* No blending */
+ OVERLAY_BLENDING_OPAQUE,
+ /* src.rgb + dst.rgb*(1-src_alpha) */
+ OVERLAY_BLENDING_PREMULT,
+ /* src.rgb * src_alpha + dst.rgb (1 - src_alpha) */
+ OVERLAY_BLENDING_COVERAGE,
+};
+
// Used to consolidate pipe params
struct PipeArgs {
PipeArgs() : mdpFlags(OV_MDP_FLAGS_NONE),
zorder(Z_SYSTEM_ALLOC),
isFg(IS_FG_OFF),
- rotFlags(ROT_FLAGS_NONE){
+ rotFlags(ROT_FLAGS_NONE),
+ planeAlpha(DEFAULT_PLANE_ALPHA),
+ blending(OVERLAY_BLENDING_COVERAGE){
}
PipeArgs(eMdpFlags f, Whf _whf,
- eZorder z, eIsFg fg, eRotFlags r) :
+ eZorder z, eIsFg fg, eRotFlags r,
+ int pA = DEFAULT_PLANE_ALPHA, eBlending b = OVERLAY_BLENDING_COVERAGE) :
mdpFlags(f),
whf(_whf),
zorder(z),
isFg(fg),
- rotFlags(r) {
+ rotFlags(r),
+ planeAlpha(pA),
+ blending(b){
}
eMdpFlags mdpFlags; // for mdp_overlay flags
@@ -351,6 +368,8 @@
eZorder zorder; // stage number
eIsFg isFg; // control alpha & transp
eRotFlags rotFlags;
+ int planeAlpha;
+ eBlending blending;
};
// Cannot use HW_OVERLAY_MAGNIFICATION_LIMIT, since at the time