Merge "hwc: Pass transform value while cropping dst rect"
diff --git a/libexternal/external.cpp b/libexternal/external.cpp
index ecacd7b..b721195 100644
--- a/libexternal/external.cpp
+++ b/libexternal/external.cpp
@@ -240,8 +240,9 @@
info.reserved[0] = 0;
info.reserved[1] = 0;
info.reserved[2] = 0;
+#ifndef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
info.reserved[3] = (info.reserved[3] & 0xFFFF) | (video_format << 16);
-
+#endif
info.xoffset = 0;
info.yoffset = 0;
info.xres = active_h;
@@ -537,6 +538,16 @@
ALOGD("In %s: FBIOPUT_VSCREENINFO failed Err Str = %s",
__FUNCTION__, strerror(errno));
}
+#ifdef FB_METADATA_VIDEO_INFO_CODE_SUPPORT
+ struct msmfb_metadata metadata;
+ memset(&metadata, 0 , sizeof(metadata));
+ metadata.op = metadata_op_vic;
+ metadata.data.video_info_code = mode->video_format;
+ if (ioctl(mFd, MSMFB_METADATA_SET, &metadata) == -1) {
+ ALOGD("In %s: MSMFB_METADATA_SET failed Err Str = %s",
+ __FUNCTION__, strerror(errno));
+ }
+#endif
mCurrentMode = ID;
}
}
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 197c372..b3e371a 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -117,7 +117,10 @@
}
}
}
+ /* need to initialize the pointer to NULL otherwise unmapping for that
+ * buffer happens twice which leads to crash */
hnd->base = 0;
+ hnd->base_metadata = 0;
return 0;
}
@@ -144,6 +147,7 @@
private_handle_t* hnd = (private_handle_t*)handle;
hnd->base = 0;
+ hnd->base_metadata = 0;
void *vaddr;
int err = gralloc_map(module, handle, &vaddr);
if (err) {
@@ -190,6 +194,7 @@
gralloc_unmap(module, handle);
}
hnd->base = 0;
+ hnd->base_metadata = 0;
// Release the genlock
if (-1 != hnd->genlockHandle) {
return genlock_release_lock((native_handle_t *)handle);
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 84b1100..130f263 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -85,7 +85,6 @@
hwc_display_contents_1_t** displays) {
memset(ctx->listStats, 0, sizeof(ctx->listStats));
for(int i = 0; i < HWC_NUM_DISPLAY_TYPES; i++){
- ctx->listStats[i].yuvIndex = -1;
hwc_display_contents_1_t *list = displays[i];
// XXX:SurfaceFlinger no longer guarantees that this
// value is reset on every prepare. However, for the layer
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index e0331ad..18f75eb 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -22,7 +22,6 @@
#include <gralloc_priv.h>
#include <fb_priv.h>
#include "hwc_fbupdate.h"
-#include "external.h"
namespace qhwc {
@@ -80,10 +79,6 @@
mDest = dest;
ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_FLAGS_NONE;
- if(ctx->mSecureMode) {
- ovutils::setMdpFlags(mdpFlags,
- ovutils::OV_MDP_SECURE_OVERLAY_SESSION);
- }
ovutils::PipeArgs parg(mdpFlags,
info,
@@ -130,7 +125,7 @@
ovutils::eDest dest = mDest;
private_handle_t *hnd = (private_handle_t *)layer->handle;
if (!ov.queueBuffer(hnd->fd, hnd->offset, dest)) {
- ALOGE("%s: queueBuffer failed for external", __FUNCTION__);
+ ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__);
ret = false;
}
return ret;
@@ -184,10 +179,6 @@
mDestRight = destR;
ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_FLAGS_NONE;
- if(ctx->mSecureMode) {
- ovutils::setMdpFlags(mdpFlagsL,
- ovutils::OV_MDP_SECURE_OVERLAY_SESSION);
- }
ovutils::PipeArgs pargL(mdpFlagsL,
info,
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 7555621..760b134 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -471,24 +471,30 @@
malloc(sizeof(PipeLayerPair) * currentFrame.count);
if(isYuvPresent(ctx, dpy)) {
- int nYuvIndex = ctx->listStats[dpy].yuvIndex;
- hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
- PipeLayerPair& info = currentFrame.pipeLayer[nYuvIndex];
- MdpPipeInfo& pipe_info = info.pipeIndex;
- pipe_info.index = getMdpPipe(ctx, MDPCOMP_OV_VG);
- if(pipe_info.index < 0) {
- ALOGD_IF(isDebug(), "%s: Unable to get pipe for Videos",
- __FUNCTION__);
- return false;
+ int nYuvCount = ctx->listStats[dpy].yuvCount;
+
+ for(int index = 0; index < nYuvCount; index ++) {
+ int nYuvIndex = ctx->listStats[dpy].yuvIndices[index];
+ hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
+ PipeLayerPair& info = currentFrame.pipeLayer[nYuvIndex];
+ MdpPipeInfo& pipe_info = info.pipeIndex;
+ pipe_info.index = getMdpPipe(ctx, MDPCOMP_OV_VG);
+ if(pipe_info.index < 0) {
+ ALOGD_IF(isDebug(), "%s: Unable to get pipe for Videos",
+ __FUNCTION__);
+ return false;
+ }
+ pipe_info.zOrder = nYuvIndex;
}
- pipe_info.zOrder = nYuvIndex;
}
for(int index = 0 ; index < layer_count ; index++ ) {
- if(index == ctx->listStats[dpy].yuvIndex )
+ hwc_layer_1_t* layer = &list->hwLayers[index];
+ private_handle_t *hnd = (private_handle_t *)layer->handle;
+
+ if(isYuvBuffer(hnd))
continue;
- hwc_layer_1_t* layer = &list->hwLayers[index];
PipeLayerPair& info = currentFrame.pipeLayer[index];
MdpPipeInfo& pipe_info = info.pipeIndex;
pipe_info.index = getMdpPipe(ctx, MDPCOMP_OV_ANY);
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 7a3adbb..e1f413c 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -172,15 +172,17 @@
ctx->listStats[dpy].numAppLayers = list->numHwLayers - 1;
ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1;
- ctx->listStats[dpy].yuvCount = 0;
- ctx->listStats[dpy].yuvIndex = -1;
ctx->listStats[dpy].skipCount = 0;
ctx->listStats[dpy].needsAlphaScale = false;
+ ctx->listStats[dpy].yuvCount = 0;
for (size_t i = 0; i < list->numHwLayers; i++) {
hwc_layer_1_t const* layer = &list->hwLayers[i];
private_handle_t *hnd = (private_handle_t *)layer->handle;
+ //reset stored yuv index
+ ctx->listStats[dpy].yuvIndices[i] = -1;
+
if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
continue;
//We disregard FB being skip for now! so the else if
@@ -192,8 +194,9 @@
ctx->listStats[dpy].needsAlphaScale = isAlphaScaled(layer);
if (UNLIKELY(isYuvBuffer(hnd))) {
- ctx->listStats[dpy].yuvCount++;
- ctx->listStats[dpy].yuvIndex = i;
+ int& yuvCount = ctx->listStats[dpy].yuvCount;
+ ctx->listStats[dpy].yuvIndices[yuvCount] = i;
+ yuvCount++;
}
}
}
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 5316347..9692986 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -82,7 +82,7 @@
int fbLayerIndex; //Always last for now. = numAppLayers
//Video specific
int yuvCount;
- int yuvIndex;
+ int yuvIndices[MAX_NUM_LAYERS];
bool needsAlphaScale;
};
diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp
index 41d4365..0c0a40d 100644
--- a/libhwcomposer/hwc_video.cpp
+++ b/libhwcomposer/hwc_video.cpp
@@ -34,7 +34,10 @@
bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
int dpy) {
- int yuvIndex = ctx->listStats[dpy].yuvIndex;
+ if(ctx->listStats[dpy].yuvCount > 1)
+ return false;
+
+ int yuvIndex = ctx->listStats[dpy].yuvIndices[0];
sIsModeOn[dpy] = false;
if(!ctx->mMDP.hasOverlay) {
@@ -184,7 +187,7 @@
return true;
}
- int yuvIndex = ctx->listStats[dpy].yuvIndex;
+ int yuvIndex = ctx->listStats[dpy].yuvIndices[0];
if(yuvIndex == -1) {
return true;
}