Merge "hwc/overlay: Add Color layer support in MDP Composition."
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
3b689fb79c
@@ -293,6 +293,10 @@ bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) {
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
|
||||
if(!hnd) {
|
||||
if (layer->flags & HWC_COLOR_FILL) {
|
||||
// Color layer
|
||||
return true;
|
||||
}
|
||||
ALOGE("%s: layer handle is NULL", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
@@ -1446,9 +1450,14 @@ bool MDPCompNonSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
||||
hwc_layer_1_t *layer = &list->hwLayers[i];
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
if(!hnd) {
|
||||
if (!(layer->flags & HWC_COLOR_FILL)) {
|
||||
ALOGE("%s handle null", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
// No PLAY for Color layer
|
||||
layerProp[i].mFlags &= ~HWC_MDPCOMP;
|
||||
continue;
|
||||
}
|
||||
|
||||
int mdpIndex = mCurrentFrame.layerToMDP[i];
|
||||
|
||||
|
||||
@@ -1366,6 +1366,42 @@ int configMdp(Overlay *ov, const PipeArgs& parg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int configColorLayer(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
const int& dpy, eMdpFlags& mdpFlags, eZorder& z,
|
||||
eIsFg& isFg, const eDest& dest) {
|
||||
|
||||
hwc_rect_t dst = layer->displayFrame;
|
||||
trimLayer(ctx, dpy, 0, dst, dst);
|
||||
|
||||
int w = ctx->dpyAttr[dpy].xres;
|
||||
int h = ctx->dpyAttr[dpy].yres;
|
||||
int dst_w = dst.right - dst.left;
|
||||
int dst_h = dst.bottom - dst.top;
|
||||
uint32_t color = layer->transform;
|
||||
Whf whf(w, h, getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888), 0);
|
||||
|
||||
if (layer->blending == HWC_BLENDING_PREMULT)
|
||||
ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_BLEND_FG_PREMULT);
|
||||
|
||||
PipeArgs parg(mdpFlags, whf, z, isFg, static_cast<eRotFlags>(0),
|
||||
layer->planeAlpha,
|
||||
(ovutils::eBlending) getBlending(layer->blending));
|
||||
|
||||
// Configure MDP pipe for Color layer
|
||||
Dim pos(dst.left, dst.top, dst_w, dst_h);
|
||||
ctx->mOverlay->setSource(parg, dest);
|
||||
ctx->mOverlay->setColor(color, dest);
|
||||
ctx->mOverlay->setTransform(0, dest);
|
||||
ctx->mOverlay->setCrop(pos, dest);
|
||||
ctx->mOverlay->setPosition(pos, dest);
|
||||
|
||||
if (!ctx->mOverlay->commit(dest)) {
|
||||
ALOGE("%s: Configure color layer failed!", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void updateSource(eTransform& orient, Whf& whf,
|
||||
hwc_rect_t& crop) {
|
||||
Dim srcCrop(crop.left, crop.top,
|
||||
@@ -1396,7 +1432,12 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
eIsFg& isFg, const eDest& dest, Rotator **rot) {
|
||||
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
|
||||
if(!hnd) {
|
||||
if (layer->flags & HWC_COLOR_FILL) {
|
||||
// Configure Color layer
|
||||
return configColorLayer(ctx, layer, dpy, mdpFlags, z, isFg, dest);
|
||||
}
|
||||
ALOGE("%s: layer handle is NULL", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -268,6 +268,10 @@ int configMdp(overlay::Overlay *ov, const ovutils::PipeArgs& parg,
|
||||
const hwc_rect_t& pos, const MetaData_t *metadata,
|
||||
const ovutils::eDest& dest);
|
||||
|
||||
int configColorLayer(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy,
|
||||
ovutils::eMdpFlags& mdpFlags, ovutils::eZorder& z,
|
||||
ovutils::eIsFg& isFg, const ovutils::eDest& dest);
|
||||
|
||||
void updateSource(ovutils::eTransform& orient, ovutils::Whf& whf,
|
||||
hwc_rect_t& crop);
|
||||
|
||||
@@ -459,7 +463,8 @@ static inline bool isYuvPresent (hwc_context_t *ctx, int dpy) {
|
||||
}
|
||||
|
||||
static inline bool has90Transform(hwc_layer_1_t *layer) {
|
||||
return (layer->transform & HWC_TRANSFORM_ROT_90);
|
||||
return ((layer->transform & HWC_TRANSFORM_ROT_90) &&
|
||||
!(layer->flags & HWC_COLOR_FILL));
|
||||
}
|
||||
|
||||
inline bool isSecurePresent(hwc_context_t *ctx, int dpy) {
|
||||
|
||||
@@ -200,6 +200,13 @@ void Overlay::setCrop(const utils::Dim& d,
|
||||
mPipeBook[index].mPipe->setCrop(d);
|
||||
}
|
||||
|
||||
void Overlay::setColor(const uint32_t color,
|
||||
utils::eDest dest) {
|
||||
int index = (int)dest;
|
||||
validate(index);
|
||||
mPipeBook[index].mPipe->setColor(color);
|
||||
}
|
||||
|
||||
void Overlay::setPosition(const utils::Dim& d,
|
||||
utils::eDest dest) {
|
||||
int index = (int)dest;
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
|
||||
void setSource(const utils::PipeArgs args, utils::eDest dest);
|
||||
void setCrop(const utils::Dim& d, utils::eDest dest);
|
||||
void setColor(const uint32_t color, utils::eDest dest);
|
||||
void setTransform(const int orientation, utils::eDest dest);
|
||||
void setPosition(const utils::Dim& dim, utils::eDest dest);
|
||||
void setVisualParams(const MetaData_t& data, utils::eDest dest);
|
||||
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
void setSource(const utils::PipeArgs& args);
|
||||
/* set crop info and pass it down to mdp */
|
||||
void setCrop(const utils::Dim& d);
|
||||
/* set color for mdp pipe */
|
||||
void setColor(const uint32_t color);
|
||||
/* set orientation */
|
||||
void setTransform(const utils::eTransform& p);
|
||||
/* set mdp position using dim */
|
||||
@@ -174,6 +176,11 @@ inline void Ctrl::setCrop(const utils::Dim& d)
|
||||
mMdp.setCrop(d);
|
||||
}
|
||||
|
||||
inline void Ctrl::setColor(const uint32_t color)
|
||||
{
|
||||
mMdp.setColor(color);
|
||||
}
|
||||
|
||||
inline bool Ctrl::setVisualParams(const MetaData_t &metadata)
|
||||
{
|
||||
if (!mMdp.setVisualParams(metadata)) {
|
||||
|
||||
@@ -122,6 +122,10 @@ void MdpCtrl::setCrop(const utils::Dim& d) {
|
||||
setSrcRectDim(d);
|
||||
}
|
||||
|
||||
void MdpCtrl::setColor(const uint32_t color) {
|
||||
mOVInfo.bg_color = color;
|
||||
}
|
||||
|
||||
void MdpCtrl::setPosition(const overlay::utils::Dim& d) {
|
||||
setDstRectDim(d);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
* Dim - ROI dimensions.
|
||||
*/
|
||||
void setCrop(const utils::Dim& d);
|
||||
/* set color for mdp pipe */
|
||||
void setColor(const uint32_t color);
|
||||
void setTransform(const utils::eTransform& orient);
|
||||
/* given a dim and w/h, set overlay dim */
|
||||
void setPosition(const utils::Dim& dim);
|
||||
|
||||
@@ -84,6 +84,10 @@ void GenericPipe::setCrop(const overlay::utils::Dim& d) {
|
||||
mCtrlData.ctrl.setCrop(d);
|
||||
}
|
||||
|
||||
void GenericPipe::setColor(const uint32_t color) {
|
||||
mCtrlData.ctrl.setColor(color);
|
||||
}
|
||||
|
||||
void GenericPipe::setTransform(const utils::eTransform& orient) {
|
||||
mCtrlData.ctrl.setTransform(orient);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
void setSource(const utils::PipeArgs& args);
|
||||
/* set crop a.k.a the region of interest */
|
||||
void setCrop(const utils::Dim& d);
|
||||
/* set color for mdp pipe */
|
||||
void setColor(const uint32_t color);
|
||||
/* set orientation*/
|
||||
void setTransform(const utils::eTransform& param);
|
||||
/* set mdp posision using dim */
|
||||
|
||||
Reference in New Issue
Block a user