hwc: Add support for EXT_ONLY Layers
If there are any EXTERNAL_ONLY layers present in the list, mark
them as HWC_OVERLAY such that SF does not compose and in hwc_set
post that layer to Ext display, ignore other layers
Change-Id: Ic5db3bfa88295167d23d1fb2be7640c9fc772054
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index 08d95be..3d4e462 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -54,6 +54,9 @@
* cannot be used with noncontiguous heaps */
GRALLOC_USAGE_PRIVATE_UNCACHED = 0x02000000,
+ /* Buffer content should be displayed on an primary display only */
+ GRALLOC_USAGE_PRIVATE_INTERNAL_ONLY = 0x04000000,
+
/* Buffer content should be displayed on an external display only */
GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY = 0x08000000,
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 7398295..9dd95ff 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -425,12 +425,18 @@
ret = -1;
}
+ int extOnlyLayerIndex =
+ ctx->listStats[dpy].extOnlyLayerIndex;
+
private_handle_t *hnd = (private_handle_t *)fbLayer->handle;
- if(copybitDone) {
+ if(extOnlyLayerIndex!= -1) {
+ hwc_layer_1_t *extLayer = &list->hwLayers[extOnlyLayerIndex];
+ hnd = (private_handle_t *)extLayer->handle;
+ } else if(copybitDone) {
hnd = ctx->mCopyBit[dpy]->getCurrentRenderBuffer();
}
- if(hnd) {
+ if(hnd && !isYuvBuffer(hnd)) {
if (!ctx->mFBUpdate[dpy]->draw(ctx, hnd)) {
ALOGE("%s: FBUpdate::draw fail!", __FUNCTION__);
ret = -1;
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 7b34df9..439432e 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -65,6 +65,12 @@
bool ret = false;
hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
if (LIKELY(ctx->mOverlay)) {
+ int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
+ // ext only layer present..
+ if(extOnlyLayerIndex != -1) {
+ layer = &list->hwLayers[extOnlyLayerIndex];
+ layer->compositionType = HWC_OVERLAY;
+ }
overlay::Overlay& ov = *(ctx->mOverlay);
private_handle_t *hnd = (private_handle_t *)layer->handle;
ovutils::Whf info(hnd->width, hnd->height,
@@ -91,8 +97,13 @@
ovutils::ROT_FLAGS_NONE);
ov.setSource(parg, dest);
- hwc_rect_t sourceCrop;
- getNonWormholeRegion(list, sourceCrop);
+ hwc_rect_t sourceCrop = layer->sourceCrop;
+ hwc_rect_t displayFrame = layer->displayFrame;
+ if(extOnlyLayerIndex == -1) {
+ getNonWormholeRegion(list, sourceCrop);
+ displayFrame = sourceCrop;
+ }
+
// x,y,w,h
ovutils::Dim dcrop(sourceCrop.left, sourceCrop.top,
sourceCrop.right - sourceCrop.left,
@@ -104,7 +115,6 @@
static_cast<ovutils::eTransform>(transform);
ov.setTransform(orient, dest);
- hwc_rect_t displayFrame = sourceCrop;
ovutils::Dim dpos(displayFrame.left,
displayFrame.top,
displayFrame.right - displayFrame.left,
@@ -165,6 +175,12 @@
bool ret = false;
hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
if (LIKELY(ctx->mOverlay)) {
+ int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
+ // ext only layer present..
+ if(extOnlyLayerIndex != -1) {
+ layer = &list->hwLayers[extOnlyLayerIndex];
+ layer->compositionType = HWC_OVERLAY;
+ }
overlay::Overlay& ov = *(ctx->mOverlay);
private_handle_t *hnd = (private_handle_t *)layer->handle;
ovutils::Whf info(hnd->width, hnd->height,
@@ -208,8 +224,12 @@
ovutils::ROT_FLAGS_NONE);
ov.setSource(pargR, destR);
- hwc_rect_t sourceCrop;
- getNonWormholeRegion(list, sourceCrop);
+ hwc_rect_t sourceCrop = layer->sourceCrop;
+ hwc_rect_t displayFrame = layer->displayFrame;
+ if(extOnlyLayerIndex == -1) {
+ getNonWormholeRegion(list, sourceCrop);
+ displayFrame = sourceCrop;
+ }
ovutils::Dim dcropL(sourceCrop.left, sourceCrop.top,
(sourceCrop.right - sourceCrop.left) / 2,
sourceCrop.bottom - sourceCrop.top);
@@ -227,7 +247,6 @@
ov.setTransform(orient, destL);
ov.setTransform(orient, destR);
- hwc_rect_t displayFrame = sourceCrop;
const int halfWidth = (displayFrame.right - displayFrame.left) / 2;
const int height = displayFrame.bottom - displayFrame.top;
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index a310679..fdaa1cb 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -326,6 +326,7 @@
ctx->listStats[dpy].preMultipliedAlpha = false;
ctx->listStats[dpy].yuvCount = 0;
char property[PROPERTY_VALUE_MAX];
+ ctx->listStats[dpy].extOnlyLayerIndex = -1;
for (size_t i = 0; i < list->numHwLayers; i++) {
hwc_layer_1_t const* layer = &list->hwLayers[i];
@@ -356,6 +357,10 @@
if(!ctx->listStats[dpy].needsAlphaScale)
ctx->listStats[dpy].needsAlphaScale = isAlphaScaled(layer);
+
+ if(UNLIKELY(isExtOnly(hnd))){
+ ctx->listStats[dpy].extOnlyLayerIndex = i;
+ }
}
if(ctx->listStats[dpy].yuvCount > 0) {
if (property_get("hw.cabl.yuv", property, NULL) > 0) {
@@ -911,4 +916,5 @@
return 0;
}
+
};//namespace qhwc
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 6e95703..0e603ce 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -91,6 +91,7 @@
//Video specific
int yuvCount;
int yuvIndices[MAX_NUM_LAYERS];
+ int extOnlyLayerIndex;
bool needsAlphaScale;
bool preMultipliedAlpha;
};