Merge "hwc: Fix debug message in uevent for external online"
diff --git a/libcopybit/software_converter.cpp b/libcopybit/software_converter.cpp
index 71e685e..9ea8767 100644
--- a/libcopybit/software_converter.cpp
+++ b/libcopybit/software_converter.cpp
@@ -60,7 +60,7 @@
unsigned char* oldChroma = (unsigned char*)(hnd->base + y_size);
memcpy((char *)yv12_handle->base,(char *)hnd->base,y_size);
-#ifdef __ARM_HAVE_NEON
+#if defined(__ARM_HAVE_NEON) && !defined(__aarch64__)
/* interleave */
if(!chromaPadding) {
unsigned char * t1 = newChroma;
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 8739f34..4067050 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -44,9 +44,6 @@
common.module = const_cast<hw_module_t*>(&module->base.common);
common.close = gralloc_close;
alloc = gralloc_alloc;
-#ifdef QCOM_BSP
- allocSize = gralloc_alloc_size;
-#endif
free = gralloc_free;
}
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 0ee69c8..2f2ddc1 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -332,23 +332,6 @@
break;
}
-#ifdef QCOM_BSP
- case GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_GEOMETRY:
- {
- int width = va_arg(args, int);
- int height = va_arg(args, int);
- int format = va_arg(args, int);
- private_handle_t* hnd = va_arg(args, private_handle_t*);
- if (private_handle_t::validate(hnd)) {
- return res;
- }
- hnd->width = width;
- hnd->height = height;
- hnd->format = format;
- res = 0;
- }
- break;
-#endif
case GRALLOC_MODULE_PERFORM_GET_STRIDE:
{
int width = va_arg(args, int);
diff --git a/libhwcomposer/hwc_ad.cpp b/libhwcomposer/hwc_ad.cpp
index 49e7e2a..a26f659 100644
--- a/libhwcomposer/hwc_ad.cpp
+++ b/libhwcomposer/hwc_ad.cpp
@@ -130,7 +130,8 @@
int nYuvIndex = ctx->listStats[HWC_DISPLAY_PRIMARY].yuvIndices[0];
const hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
private_handle_t *hnd = (private_handle_t *)layer->handle;
- if(hnd && hnd->width <= qdutils::MAX_DISPLAY_DIM) {
+ qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
+ if(hnd && hnd->width <= mdpHw.getMaxMixerWidth()) {
mDoable = true;
}
}
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index a5ecb3a..24fd771 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -234,9 +234,6 @@
finalW = max(finalW, ALIGN((overlap.right - overlap.left), 32));
finalH += ALIGN((overlap.bottom - overlap.top), 32);
if(finalH > ALIGN((overlap.bottom - overlap.top), 32)) {
- // Calculate the offset for RGBA(4BPP)
- ptorInfo->mRenderBuffOffset[i] = finalW *
- (finalH - ALIGN((overlap.bottom - overlap.top), 32)) * 4;
// Calculate the dest top, left will always be zero
ptorInfo->displayFrame[i].top = (finalH -
(ALIGN((overlap.bottom - overlap.top), 32)));
@@ -276,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_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index de4cd05..5014af9 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -474,7 +474,7 @@
ovutils::eDest destR = ovutils::OV_INVALID;
/* Use 2 pipes IF
- a) FB's width is > 2048 or
+ a) FB's width is > Mixer width or
b) On primary, driver has indicated with caps to split always. This is
based on an empirically derived value of panel height.
*/
@@ -483,7 +483,7 @@
qdutils::MDPVersion::getInstance().isSrcSplitAlways();
if(((fbUpdatingRect.right - fbUpdatingRect.left) >
- qdutils::MAX_DISPLAY_DIM) or
+ (int)qdutils::MDPVersion::getInstance().getMaxMixerWidth()) or
primarySplitAlways) {
destR = ov.getPipe(pipeSpecs);
if(destR == ovutils::OV_INVALID) {
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 3a60fa3..863c69e 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -349,6 +349,7 @@
int dst_h = dst.bottom - dst.top;
float w_scale = ((float)crop_w / (float)dst_w);
float h_scale = ((float)crop_h / (float)dst_h);
+ MDPVersion& mdpHw = MDPVersion::getInstance();
/* Workaround for MDP HW limitation in DSI command mode panels where
* FPS will not go beyond 30 if buffers on RGB pipes are of width or height
@@ -360,29 +361,29 @@
return false;
if((w_scale > 1.0f) || (h_scale > 1.0f)) {
- const uint32_t maxMDPDownscale =
- qdutils::MDPVersion::getInstance().getMaxMDPDownscale();
+ const uint32_t maxMDPDownscale = mdpHw.getMaxMDPDownscale();
const float w_dscale = w_scale;
const float h_dscale = h_scale;
if(ctx->mMDP.version >= qdutils::MDSS_V5) {
- if(!qdutils::MDPVersion::getInstance().supportsDecimation()) {
+ if(!mdpHw.supportsDecimation()) {
/* On targets that doesnt support Decimation (eg.,8x26)
* maximum downscale support is overlay pipe downscale.
*/
- if(crop_w > MAX_DISPLAY_DIM || w_dscale > maxMDPDownscale ||
+ if(crop_w > mdpHw.getMaxMixerWidth() ||
+ w_dscale > maxMDPDownscale ||
h_dscale > maxMDPDownscale)
return false;
} else {
// Decimation on macrotile format layers is not supported.
if(isTileRendered(hnd)) {
- /* MDP can read maximum MAX_DISPLAY_DIM width.
- * Bail out if
- * 1. Src crop > MAX_DISPLAY_DIM on nonsplit MDPComp
+ /* Bail out if
+ * 1. Src crop > Mixer limit on nonsplit MDPComp
* 2. exceeds maximum downscale limit
*/
- if(((crop_w > MAX_DISPLAY_DIM) && !sSrcSplitEnabled) ||
+ if(((crop_w > mdpHw.getMaxMixerWidth()) &&
+ !sSrcSplitEnabled) ||
w_dscale > maxMDPDownscale ||
h_dscale > maxMDPDownscale) {
return false;
@@ -397,8 +398,7 @@
}
if((w_scale < 1.0f) || (h_scale < 1.0f)) {
- const uint32_t upscale =
- qdutils::MDPVersion::getInstance().getMaxMDPUpscale();
+ const uint32_t upscale = mdpHw.getMaxMDPUpscale();
const float w_uscale = 1.0f / w_scale;
const float h_uscale = 1.0f / h_scale;
@@ -688,8 +688,10 @@
return false;
}
- if(mDpy > HWC_DISPLAY_PRIMARY && (priDispW > MAX_DISPLAY_DIM) &&
- (ctx->dpyAttr[mDpy].xres < MAX_DISPLAY_DIM)) {
+ MDPVersion& mdpHw = MDPVersion::getInstance();
+ if(mDpy > HWC_DISPLAY_PRIMARY &&
+ (priDispW > mdpHw.getMaxMixerWidth()) &&
+ (ctx->dpyAttr[mDpy].xres < mdpHw.getMaxMixerWidth())) {
// Disable MDP comp on Secondary when the primary is highres panel and
// the secondary is a normal 1080p, because, MDP comp on secondary under
// in such usecase, decimation gets used for downscale and there will be
@@ -721,11 +723,9 @@
//For 8x26 with panel width>1k, if RGB layer needs HFLIP fail mdp comp
// may not need it if Gfx pre-rotation can handle all flips & rotations
int transform = (layer->flags & HWC_COLOR_FILL) ? 0 : layer->transform;
- if(qdutils::MDPVersion::getInstance().is8x26() &&
- (ctx->dpyAttr[mDpy].xres > 1024) &&
- (transform & HWC_TRANSFORM_FLIP_H) &&
- (!isYuvBuffer(hnd)))
- return false;
+ if( mdpHw.is8x26() && (ctx->dpyAttr[mDpy].xres > 1024) &&
+ (transform & HWC_TRANSFORM_FLIP_H) && (!isYuvBuffer(hnd)))
+ return false;
}
if(ctx->mAD->isDoable()) {
@@ -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)) {
@@ -2259,14 +2287,15 @@
if the layer's width is > mixer's width
*/
+ MDPVersion& mdpHw = MDPVersion::getInstance();
bool primarySplitAlways = (mDpy == HWC_DISPLAY_PRIMARY) and
- qdutils::MDPVersion::getInstance().isSrcSplitAlways();
+ mdpHw.isSrcSplitAlways();
int lSplit = getLeftSplit(ctx, mDpy);
int dstWidth = dst.right - dst.left;
int cropWidth = crop.right - crop.left;
- if(dstWidth > qdutils::MAX_DISPLAY_DIM or
- cropWidth > qdutils::MAX_DISPLAY_DIM or
+ if(dstWidth > mdpHw.getMaxMixerWidth() or
+ cropWidth > mdpHw.getMaxMixerWidth() or
(primarySplitAlways and (cropWidth > lSplit))) {
pipe_info.rIndex = ctx->mOverlay->getPipe(pipeSpecs);
if(pipe_info.rIndex == ovutils::OV_INVALID) {
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 879e4bd..3696c05 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -78,7 +78,7 @@
bool isValidResolution(hwc_context_t *ctx, uint32_t xres, uint32_t yres)
{
- return !((xres > qdutils::MAX_DISPLAY_DIM &&
+ return !((xres > qdutils::MDPVersion::getInstance().getMaxMixerWidth() &&
!isDisplaySplit(ctx, HWC_DISPLAY_PRIMARY)) ||
(xres < MIN_DISPLAY_XRES || yres < MIN_DISPLAY_YRES));
}
@@ -273,9 +273,15 @@
//independent process as well.
QService::init();
sp<IQClient> client = new QClient(ctx);
- interface_cast<IQService>(
+ android::sp<qService::IQService> qservice_sp = interface_cast<IQService>(
defaultServiceManager()->getService(
- String16("display.qservice")))->connect(client);
+ String16("display.qservice")));
+ if (qservice_sp.get()) {
+ qservice_sp->connect(client);
+ } else {
+ ALOGE("%s: Failed to acquire service pointer", __FUNCTION__);
+ return ;
+ }
// Initialize device orientation to its default orientation
ctx->deviceOrientation = 0;
@@ -1438,8 +1444,8 @@
fd = -1;
}
- if (!dpy && ctx->mCopyBit[dpy]) {
- if (ctx->mPtorInfo.isActive())
+ if (ctx->mCopyBit[dpy]) {
+ if (!dpy && ctx->mPtorInfo.isActive())
ctx->mCopyBit[dpy]->setReleaseFdSync(releaseFd);
else
ctx->mCopyBit[dpy]->setReleaseFd(releaseFd);
@@ -2034,12 +2040,12 @@
}
bool isDisplaySplit(hwc_context_t* ctx, int dpy) {
- if(ctx->dpyAttr[dpy].xres > qdutils::MAX_DISPLAY_DIM) {
+ qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
+ if(ctx->dpyAttr[dpy].xres > mdpHw.getMaxMixerWidth()) {
return true;
}
//For testing we could split primary via device tree values
- if(dpy == HWC_DISPLAY_PRIMARY &&
- qdutils::MDPVersion::getInstance().getRightSplit()) {
+ if(dpy == HWC_DISPLAY_PRIMARY && mdpHw.getRightSplit()) {
return true;
}
return false;
@@ -2173,7 +2179,8 @@
const hwc_rect_t& dst, const int& transform,
ovutils::eMdpFlags& mdpFlags) {
//Target doesnt support Bwc
- if(!qdutils::MDPVersion::getInstance().supportsBWC()) {
+ qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
+ if(!mdpHw.supportsBWC()) {
return;
}
int src_w = crop.right - crop.left;
@@ -2184,7 +2191,7 @@
swap(src_w, src_h);
}
//src width > MAX mixer supported dim
- if(src_w > qdutils::MAX_DISPLAY_DIM) {
+ if(src_w > qdutils::MDPVersion::getInstance().getMaxMixerWidth()) {
return;
}
//Decimation necessary, cannot use BWC. H/W requirement.
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)
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index 6b53522..48f7cb7 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -37,6 +37,12 @@
#define TOKEN_PARAMS_DELIM "="
+// chip variants have same major number and minor numbers usually vary
+// for e.g., MDSS_MDP_HW_REV_101 is 0x10010000
+// 1001 - major number
+// 0000 - minor number
+// 8x26 v1 minor number is 0000
+// v2 minor number is 0001 etc..
#ifndef MDSS_MDP_HW_REV_100
#define MDSS_MDP_HW_REV_100 0x10000000 //8974 v1
#endif
@@ -92,6 +98,10 @@
mRGBHasNoScalar = false;
mRotDownscale = false;
+ // this is the default limit of mixer unless driver reports it.
+ // For resolutions beyond this, we use dual/split overlay pipes.
+ mMaxMixerWidth = 2048;
+
updatePanelInfo();
if(!updateSysFsInfo()) {
@@ -279,6 +289,9 @@
} else if(!strncmp(tokens[0], "max_bandwidth_high",
strlen("max_bandwidth_high"))) {
mHighBw = atol(tokens[1]);
+ } else if(!strncmp(tokens[0], "max_mixer_width",
+ strlen("max_mixer_width"))) {
+ mMaxMixerWidth = atoi(tokens[1]);
} else if(!strncmp(tokens[0], "features", strlen("features"))) {
for(int i=1; i<index;i++) {
if(!strncmp(tokens[i], "bwc", strlen("bwc"))) {
diff --git a/libqdutils/mdp_version.h b/libqdutils/mdp_version.h
index 6c4a3f4..ced414e 100644
--- a/libqdutils/mdp_version.h
+++ b/libqdutils/mdp_version.h
@@ -57,17 +57,6 @@
MDSS_V5 = 500,
};
-// chip variants have same major number and minor numbers usually vary
-// for e.g., MDSS_MDP_HW_REV_101 is 0x10010000
-// 1001 - major number
-// 0000 - minor number
-// 8x26 v1 minor number is 0000
-// v2 minor number is 0001 etc..
-
-enum {
- MAX_DISPLAY_DIM = 2048,
-};
-
#define NO_PANEL '0'
#define MDDI_PANEL '1'
#define EBI2_PANEL '2'
@@ -140,6 +129,7 @@
unsigned long getLowBw() { return mLowBw; }
unsigned long getHighBw() { return mHighBw; }
bool isRotDownscaleEnabled() { return mRotDownscale; }
+ int getMaxMixerWidth() const { return mMaxMixerWidth; }
bool isSrcSplit() const;
bool isSrcSplitAlways() const;
bool isRGBScalarSupported() const;
@@ -177,6 +167,7 @@
bool mSourceSplitAlways;
bool mRGBHasNoScalar;
bool mRotDownscale;
+ uint32_t mMaxMixerWidth; //maximum x-res of a given mdss mixer.
};
}; //namespace qdutils
#endif //INCLUDE_LIBQCOMUTILS_MDPVER