Merge "copybit: Avoid NEON instructions in s/w converter on 64bit"
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 33d460b..24fd771 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -248,14 +248,6 @@
getBufferSizeAndDimensions(finalW, finalH, HAL_PIXEL_FORMAT_RGBA_8888,
alignW, alignH);
- int heightFromTop = 0;
- for (int i = 0; i < ptorInfo->count; i++) {
- // Offset depends on stride calculated by gralloc for RGBA (4 bpp)
- ptorInfo->mRenderBuffOffset[i] = alignW * heightFromTop * 4;
- heightFromTop += ALIGN((ptorInfo->displayFrame[i].bottom -
- ptorInfo->displayFrame[i].top), 32);
- }
-
if ((mAlignedWidth != alignW) || (mAlignedHeight != alignH)) {
// Overlap rect has changed, so free render buffers
freeRenderBuffers();
@@ -281,6 +273,13 @@
// No copybit device found - cannot use copybit
return false;
}
+
+ if(ctx->mThermalBurstMode) {
+ ALOGD_IF (DEBUG_COPYBIT, "%s:Copybit failed,"
+ "Running in Thermal Burst mode",__FUNCTION__);
+ return false;
+ }
+
int compositionType = qdutils::QCCompositionType::
getInstance().getCompositionType();
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index adf30fe..863c69e 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -800,7 +800,7 @@
ctx->mOverlay->availablePipes(mDpy, Overlay::MIXER_DEFAULT));
// Hard checks where we cannot use this mode
- if (mDpy || !ctx->mCopyBit[mDpy] || isDisplaySplit(ctx, mDpy)) {
+ if (mDpy || !ctx->mCopyBit[mDpy]) {
ALOGD_IF(isDebug(), "%s: Feature not supported!", __FUNCTION__);
return false;
}
@@ -849,18 +849,19 @@
// Overlap area > (1/3 * FrameBuffer) area, based on Perf inputs.
continue;
}
- // Found the PTOR layer
- bool found = true;
+ bool found = false;
for (int j = i-1; j >= 0; j--) {
// Check if the layers below this layer qualifies for PTOR comp
hwc_layer_1_t* layer = &list->hwLayers[j];
hwc_rect_t disFrame = layer->displayFrame;
- //layer below PTOR is intersecting and has 90 degree transform or
+ // Layer below PTOR is intersecting and has 90 degree transform or
// needs scaling cannot be supported.
- if ((isValidRect(getIntersection(dispFrame, disFrame)))
- && (has90Transform(layer) || needsScaling(layer))) {
- found = false;
- break;
+ if (isValidRect(getIntersection(dispFrame, disFrame))) {
+ if (has90Transform(layer) || needsScaling(layer)) {
+ found = false;
+ break;
+ }
+ found = true;
}
}
// Store the minLayer Index
@@ -903,11 +904,30 @@
sourceCrop[i] = integerizeSourceCrop(layer->sourceCropf);
}
+ private_handle_t *renderBuf = ctx->mCopyBit[mDpy]->getCurrentRenderBuffer();
+ Whf layerWhf[numPTORLayersFound]; // To store w,h,f of PTOR layers
+
for(int j = 0; j < numPTORLayersFound; j++) {
int index = ctx->mPtorInfo.layerIndex[j];
+
+ // Update src crop of PTOR layer
+ hwc_layer_1_t* layer = &list->hwLayers[index];
+ layer->sourceCropf.left = (float)ctx->mPtorInfo.displayFrame[j].left;
+ layer->sourceCropf.top = (float)ctx->mPtorInfo.displayFrame[j].top;
+ layer->sourceCropf.right = (float)ctx->mPtorInfo.displayFrame[j].right;
+ layer->sourceCropf.bottom =(float)ctx->mPtorInfo.displayFrame[j].bottom;
+
+ // Store & update w, h, format of PTOR layer
+ private_handle_t *hnd = (private_handle_t *)layer->handle;
+ Whf whf(hnd->width, hnd->height, hnd->format, hnd->size);
+ layerWhf[j] = whf;
+ hnd->width = renderBuf->width;
+ hnd->height = renderBuf->height;
+ hnd->format = renderBuf->format;
+
// Remove overlap from crop & displayFrame of below layers
for (int i = 0; i < index && index !=-1; i++) {
- hwc_layer_1_t* layer = &list->hwLayers[i];
+ layer = &list->hwLayers[i];
if(!isValidRect(getIntersection(layer->displayFrame,
overlapRect[j]))) {
continue;
@@ -944,6 +964,15 @@
layer->sourceCropf.bottom = (float)sourceCrop[i].bottom;
}
+ // Restore w,h,f of PTOR layers
+ for (int i = 0; i < numPTORLayersFound; i++) {
+ int idx = ctx->mPtorInfo.layerIndex[i];
+ private_handle_t *hnd = (private_handle_t *)list->hwLayers[idx].handle;
+ hnd->width = layerWhf[i].w;
+ hnd->height = layerWhf[i].h;
+ hnd->format = layerWhf[i].format;
+ }
+
if (!result) {
// reset PTOR
ctx->mPtorInfo.count = 0;
@@ -1928,8 +1957,7 @@
if (!mDpy && (index != -1)) {
hnd = ctx->mCopyBit[mDpy]->getCurrentRenderBuffer();
fd = hnd->fd;
- // Use the offset of the RenderBuffer
- offset = ctx->mPtorInfo.mRenderBuffOffset[index];
+ offset = 0;
}
ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
@@ -2180,7 +2208,7 @@
if (!mDpy && (index != -1)) {
hnd = ctx->mCopyBit[mDpy]->getCurrentRenderBuffer();
fd = hnd->fd;
- offset = ctx->mPtorInfo.mRenderBuffOffset[index];
+ offset = 0;
}
if(ctx->mAD->draw(ctx, fd, offset)) {
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index dd55f8b..66fdc65 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -137,7 +137,6 @@
struct PtorInfo {
int count;
int layerIndex[MAX_PTOR_LAYERS];
- int mRenderBuffOffset[MAX_PTOR_LAYERS];
hwc_rect_t displayFrame[MAX_PTOR_LAYERS];
bool isActive() { return (count>0); }
int getPTORArrayIndex(int index) {
@@ -594,6 +593,8 @@
bool enableABC;
// PTOR Info
qhwc::PtorInfo mPtorInfo;
+ //Running in Thermal burst mode
+ bool mThermalBurstMode;
};
namespace qhwc {
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 47f2229..6c6ba63 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -39,6 +39,7 @@
#define MAX_SYSFS_FILE_PATH 255
#define PANEL_ON_STR "panel_power_on ="
#define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
+#define MAX_THERMAL_LEVEL 3
const int MAX_DATA = 64;
int hwc_vsync_control(hwc_context_t* ctx, int dpy, int enable)
@@ -76,6 +77,20 @@
}
}
+static void handle_thermal_event(hwc_context_t* ctx, int dpy, char *data)
+{
+ // extract thermal level
+ uint64_t thermalLevel = 0;
+ if (!strncmp(data, "thermal_level=", strlen("thermal_level="))) {
+ thermalLevel = strtoull(data + strlen("thermal_level="), NULL, 0);
+ }
+
+ if (thermalLevel >= MAX_THERMAL_LEVEL)
+ ctx->mThermalBurstMode = true;
+ else
+ ctx->mThermalBurstMode = false;
+}
+
struct event {
const char* name;
void (*callback)(hwc_context_t* ctx, int dpy, char *data);
@@ -84,6 +99,7 @@
struct event event_list[] = {
{ "vsync_event", handle_vsync_event },
{ "show_blank_event", handle_blank_event },
+ { "msm_fb_thermal_level", handle_thermal_event },
};
#define num_events ARRAY_LENGTH(event_list)