hwc: Use correct z-order in video overlay

Set z-order of video layer to 0 and framebuffer to 1 in case
of video overlay composition so that the blending takes effect.
Also set is_fg OFF for framebuffer.

Change-Id: I05f930074d265d690f29a1003b7c28077df89bbf
CRs-fixed: 458180
This commit is contained in:
Sravan Kumar D.V.N
2013-03-15 08:51:16 +05:30
committed by Gerrit - the friendly Code Review server
parent 22dd8e7ef2
commit b5ed029da8
5 changed files with 42 additions and 8 deletions

View File

@@ -21,6 +21,7 @@
#define DEBUG_FBUPDATE 0
#include <gralloc_priv.h>
#include "hwc_fbupdate.h"
#include "hwc_video.h"
namespace qhwc {
@@ -82,11 +83,20 @@ bool FBUpdateLowRes::configure(hwc_context_t *ctx,
mDest = dest;
ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE;
// If any of the layers has pre-multiplied alpha, set Pre multiplied
// Flag as the compositied output is alpha pre-multiplied.
if(ctx->listStats[mDpy].preMultipliedAlpha == true)
ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_BLEND_FG_PREMULT);
ovutils::eZorder z_order =
ctx->mVidOv[mDpy]->isModeOn()?ovutils::ZORDER_1:ovutils::ZORDER_0;
ovutils::eIsFg is_fg =
ctx->mVidOv[mDpy]->isModeOn()? ovutils::IS_FG_OFF:ovutils::IS_FG_SET;
ovutils::PipeArgs parg(mdpFlags,
info,
ovutils::ZORDER_0,
ovutils::IS_FG_SET,
z_order,
is_fg,
ovutils::ROT_FLAGS_NONE);
ov.setSource(parg, dest);
@@ -189,11 +199,20 @@ bool FBUpdateHighRes::configure(hwc_context_t *ctx,
mDestRight = destR;
ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_FLAGS_NONE;
//If any layer has pre-multiplied alpha, set Pre multiplied
//Flag as the compositied output is alpha pre-multiplied.
if(ctx->listStats[mDpy].preMultipliedAlpha == true)
ovutils::setMdpFlags(mdpFlagsL, ovutils::OV_MDP_BLEND_FG_PREMULT);
ovutils::eZorder z_order =
ctx->mVidOv[mDpy]->isModeOn()?ovutils::ZORDER_1:ovutils::ZORDER_0;
ovutils::eIsFg is_fg =
ctx->mVidOv[mDpy]->isModeOn()? ovutils::IS_FG_OFF:ovutils::IS_FG_SET;
ovutils::PipeArgs pargL(mdpFlagsL,
info,
ovutils::ZORDER_0,
ovutils::IS_FG_SET,
z_order,
is_fg,
ovutils::ROT_FLAGS_NONE);
ov.setSource(pargL, destL);
@@ -201,8 +220,8 @@ bool FBUpdateHighRes::configure(hwc_context_t *ctx,
ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER);
ovutils::PipeArgs pargR(mdpFlagsR,
info,
ovutils::ZORDER_0,
ovutils::IS_FG_SET,
z_order,
is_fg,
ovutils::ROT_FLAGS_NONE);
ov.setSource(pargR, destR);

View File

@@ -298,6 +298,7 @@ void setListStats(hwc_context_t *ctx,
ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1;
ctx->listStats[dpy].skipCount = 0;
ctx->listStats[dpy].needsAlphaScale = false;
ctx->listStats[dpy].preMultipliedAlpha = false;
ctx->listStats[dpy].yuvCount = 0;
for (size_t i = 0; i < list->numHwLayers; i++) {
@@ -320,6 +321,8 @@ void setListStats(hwc_context_t *ctx,
if(layer->transform & HWC_TRANSFORM_ROT_90)
ctx->mNeedsRotator = true;
}
if(layer->blending == HWC_BLENDING_PREMULT)
ctx->listStats[dpy].preMultipliedAlpha = true;
if(!ctx->listStats[dpy].needsAlphaScale)
ctx->listStats[dpy].needsAlphaScale = isAlphaScaled(layer);

View File

@@ -94,6 +94,7 @@ struct ListStats {
int yuvCount;
int yuvIndices[MAX_NUM_LAYERS];
bool needsAlphaScale;
bool preMultipliedAlpha;
};
struct LayerProp {

View File

@@ -132,7 +132,7 @@ bool VideoOverlayLowRes::configure(hwc_context_t *ctx,
mDest = dest;
ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE;
ovutils::eZorder zOrder = ovutils::ZORDER_1;
ovutils::eZorder zOrder = ovutils::ZORDER_0;
ovutils::eIsFg isFg = ovutils::IS_FG_OFF;
if (ctx->listStats[mDpy].numAppLayers == 1) {
isFg = ovutils::IS_FG_SET;
@@ -176,6 +176,10 @@ bool VideoOverlayLowRes::draw(hwc_context_t *ctx,
return true;
}
bool VideoOverlayLowRes::isModeOn() {
return mModeOn;
}
//===========VideoOverlayHighRes=========================
VideoOverlayHighRes::VideoOverlayHighRes(const int& dpy): IVideoOverlay(dpy) {}
@@ -244,7 +248,7 @@ bool VideoOverlayHighRes::configure(hwc_context_t *ctx,
}
ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE;
ovutils::eZorder zOrder = ovutils::ZORDER_1;
ovutils::eZorder zOrder = ovutils::ZORDER_0;
ovutils::eIsFg isFg = ovutils::IS_FG_OFF;
if (ctx->listStats[mDpy].numAppLayers == 1) {
isFg = ovutils::IS_FG_SET;
@@ -299,5 +303,8 @@ bool VideoOverlayHighRes::draw(hwc_context_t *ctx,
return true;
}
bool VideoOverlayHighRes::isModeOn() {
return mModeOn;
}
}; //namespace qhwc

View File

@@ -40,8 +40,10 @@ public:
virtual bool draw(hwc_context_t *ctx,
hwc_display_contents_1_t *list) = 0;
virtual void reset() = 0;
virtual bool isModeOn() = 0;
//Factory method that returns a low-res or high-res version
static IVideoOverlay *getObject(const int& width, const int& dpy);
protected:
const int mDpy; // display to update
bool mModeOn; // if prepare happened
@@ -55,6 +57,7 @@ public:
bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list);
bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
void reset();
bool isModeOn();
private:
//Configures overlay for video prim and ext
bool configure(hwc_context_t *ctx, hwc_layer_1_t *yuvlayer);
@@ -72,6 +75,7 @@ public:
bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list);
bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
void reset();
bool isModeOn();
private:
//Configures overlay for video prim and ext
bool configure(hwc_context_t *ctx, hwc_layer_1_t *yuvlayer);