Merge "overlay: pipe reservation mechanism for overlay"
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 2a1b123..01f4b99 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -293,6 +293,10 @@
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,8 +1450,13 @@
hwc_layer_1_t *layer = &list->hwLayers[i];
private_handle_t *hnd = (private_handle_t *)layer->handle;
if(!hnd) {
- ALOGE("%s handle null", __FUNCTION__);
- return false;
+ 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];
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index f32ad34..eed6e9d 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1366,6 +1366,42 @@
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 @@
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;
}
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 66a02d6..6288057 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -268,6 +268,10 @@
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 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) {
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
index 6784d4f..432ba81 100644
--- a/liboverlay/overlay.cpp
+++ b/liboverlay/overlay.cpp
@@ -230,6 +230,13 @@
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;
diff --git a/liboverlay/overlay.h b/liboverlay/overlay.h
index 13debb7..e88c89c 100644
--- a/liboverlay/overlay.h
+++ b/liboverlay/overlay.h
@@ -88,6 +88,7 @@
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);
diff --git a/liboverlay/overlayCtrlData.h b/liboverlay/overlayCtrlData.h
index 6746792..18ef5e6 100644
--- a/liboverlay/overlayCtrlData.h
+++ b/liboverlay/overlayCtrlData.h
@@ -61,6 +61,8 @@
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 @@
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)) {
diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp
index b4058bd..fbb173e 100644
--- a/liboverlay/overlayMdp.cpp
+++ b/liboverlay/overlayMdp.cpp
@@ -122,6 +122,10 @@
setSrcRectDim(d);
}
+void MdpCtrl::setColor(const uint32_t color) {
+ mOVInfo.bg_color = color;
+}
+
void MdpCtrl::setPosition(const overlay::utils::Dim& d) {
setDstRectDim(d);
}
diff --git a/liboverlay/overlayMdp.h b/liboverlay/overlayMdp.h
index fe4ad69..6dd3976 100644
--- a/liboverlay/overlayMdp.h
+++ b/liboverlay/overlayMdp.h
@@ -57,6 +57,8 @@
* 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);
diff --git a/liboverlay/pipes/overlayGenPipe.cpp b/liboverlay/pipes/overlayGenPipe.cpp
index 54e847b..c03378b 100644
--- a/liboverlay/pipes/overlayGenPipe.cpp
+++ b/liboverlay/pipes/overlayGenPipe.cpp
@@ -84,6 +84,10 @@
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);
}
diff --git a/liboverlay/pipes/overlayGenPipe.h b/liboverlay/pipes/overlayGenPipe.h
index b5c11fe..5c963bc 100644
--- a/liboverlay/pipes/overlayGenPipe.h
+++ b/liboverlay/pipes/overlayGenPipe.h
@@ -48,6 +48,8 @@
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 */