summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRicardo Cerqueira <ricardo@cyngn.com>2015-11-05 01:41:42 +0000
committerRicardo Cerqueira <ricardo@cyngn.com>2015-11-05 01:41:42 +0000
commit1cdd1b5ad204cb319174f86b522fcb0dc7968ed6 (patch)
tree208c78f58721f44168992cf88ae8d2b821f090de /services
parent5e78568dab3b1bbddd1cbc0dd2004d9c2ddbdfeb (diff)
parent3492a21877f93b2240dc823392b7e8adb2e1809e (diff)
downloadframeworks_native-1cdd1b5ad204cb319174f86b522fcb0dc7968ed6.zip
frameworks_native-1cdd1b5ad204cb319174f86b522fcb0dc7968ed6.tar.gz
frameworks_native-1cdd1b5ad204cb319174f86b522fcb0dc7968ed6.tar.bz2
Merge tag 'android-6.0.0_r26' into HEAD
Android 6.0.0 release 26 Conflicts: include/android/input.h Change-Id: Ifa374c6d3055be3b8a5d60967f8b4c0043da739b
Diffstat (limited to 'services')
-rw-r--r--services/batteryservice/BatteryProperties.cpp2
-rw-r--r--services/inputflinger/InputReader.cpp6
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp27
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.h1
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp53
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h1
6 files changed, 69 insertions, 21 deletions
diff --git a/services/batteryservice/BatteryProperties.cpp b/services/batteryservice/BatteryProperties.cpp
index 0ae637c..55c7813 100644
--- a/services/batteryservice/BatteryProperties.cpp
+++ b/services/batteryservice/BatteryProperties.cpp
@@ -34,6 +34,7 @@ status_t BatteryProperties::readFromParcel(Parcel* p) {
chargerAcOnline = p->readInt32() == 1 ? true : false;
chargerUsbOnline = p->readInt32() == 1 ? true : false;
chargerWirelessOnline = p->readInt32() == 1 ? true : false;
+ maxChargingCurrent = p->readInt32();
batteryStatus = p->readInt32();
batteryHealth = p->readInt32();
batteryPresent = p->readInt32() == 1 ? true : false;
@@ -69,6 +70,7 @@ status_t BatteryProperties::writeToParcel(Parcel* p) const {
p->writeInt32(chargerAcOnline ? 1 : 0);
p->writeInt32(chargerUsbOnline ? 1 : 0);
p->writeInt32(chargerWirelessOnline ? 1 : 0);
+ p->writeInt32(maxChargingCurrent);
p->writeInt32(batteryStatus);
p->writeInt32(batteryHealth);
p->writeInt32(batteryPresent ? 1 : 0);
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index da442b2..3813d9b 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -4724,7 +4724,7 @@ void TouchInputMapper::cookPointerData() {
bottom = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate;
top = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate;
orientation -= M_PI_2;
- if (orientation < mOrientedRanges.orientation.min) {
+ if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
@@ -4736,7 +4736,7 @@ void TouchInputMapper::cookPointerData() {
bottom = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate;
top = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate;
orientation -= M_PI;
- if (orientation < mOrientedRanges.orientation.min) {
+ if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
@@ -4748,7 +4748,7 @@ void TouchInputMapper::cookPointerData() {
bottom = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
top = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
orientation += M_PI_2;
- if (orientation > mOrientedRanges.orientation.max) {
+ if (mOrientedRanges.haveOrientation && orientation > mOrientedRanges.orientation.max) {
orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 5bdcd7f..c57dd5f 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -341,10 +341,20 @@ static const uint32_t DISPLAY_ATTRIBUTES[] = {
HWC_DISPLAY_HEIGHT,
HWC_DISPLAY_DPI_X,
HWC_DISPLAY_DPI_Y,
+ HWC_DISPLAY_COLOR_TRANSFORM,
HWC_DISPLAY_NO_ATTRIBUTE,
};
#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0])
+static const uint32_t PRE_HWC15_DISPLAY_ATTRIBUTES[] = {
+ HWC_DISPLAY_VSYNC_PERIOD,
+ HWC_DISPLAY_WIDTH,
+ HWC_DISPLAY_HEIGHT,
+ HWC_DISPLAY_DPI_X,
+ HWC_DISPLAY_DPI_Y,
+ HWC_DISPLAY_NO_ATTRIBUTE,
+};
+
status_t HWComposer::queryDisplayProperties(int disp) {
LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1));
@@ -372,6 +382,12 @@ status_t HWComposer::queryDisplayProperties(int disp) {
for (size_t c = 0; c < numConfigs; ++c) {
err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
DISPLAY_ATTRIBUTES, values);
+ // If this is a pre-1.5 HWC, it may not know about color transform, so
+ // try again with a smaller set of attributes
+ if (err != NO_ERROR) {
+ err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
+ PRE_HWC15_DISPLAY_ATTRIBUTES, values);
+ }
if (err != NO_ERROR) {
// we can't get this display's info. turn it off.
mDisplayData[disp].connected = false;
@@ -396,6 +412,9 @@ status_t HWComposer::queryDisplayProperties(int disp) {
case HWC_DISPLAY_DPI_Y:
config.ydpi = values[i] / 1000.0f;
break;
+ case HWC_DISPLAY_COLOR_TRANSFORM:
+ config.colorTransform = values[i];
+ break;
default:
ALOG_ASSERT(false, "unknown display attribute[%zu] %#x",
i, DISPLAY_ATTRIBUTES[i]);
@@ -1195,9 +1214,11 @@ void HWComposer::dump(String8& result) const {
result.appendFormat(" Display[%zd] configurations (* current):\n", i);
for (size_t c = 0; c < disp.configs.size(); ++c) {
const DisplayConfig& config(disp.configs[c]);
- result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, refresh=%" PRId64 "\n",
- c == disp.currentConfig ? "* " : "", c, config.width, config.height,
- config.xdpi, config.ydpi, config.refresh);
+ result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f"
+ ", refresh=%" PRId64 ", colorTransform=%d\n",
+ c == disp.currentConfig ? "* " : "", c,
+ config.width, config.height, config.xdpi, config.ydpi,
+ config.refresh, config.colorTransform);
}
if (disp.list) {
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index ea9a208..862288f 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -264,6 +264,7 @@ public:
float xdpi;
float ydpi;
nsecs_t refresh;
+ int colorTransform;
};
// Query display parameters. Pass in a display index (e.g.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e1d9020..fc99fa0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -167,6 +167,9 @@ SurfaceFlinger::SurfaceFlinger()
property_get("ro.bq.gpu_to_cpu_unsupported", value, "0");
mGpuToCpuSupported = !atoi(value);
+ property_get("debug.sf.drop_missed_frames", value, "0");
+ mDropMissedFrames = atoi(value);
+
property_get("debug.sf.showupdates", value, "0");
mDebugRegion = atoi(value);
@@ -446,6 +449,15 @@ void SurfaceFlinger::init() {
mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(mEGLDisplay, NULL, NULL);
+ // start the EventThread
+ sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ vsyncPhaseOffsetNs, true, "app");
+ mEventThread = new EventThread(vsyncSrc);
+ sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ sfVsyncPhaseOffsetNs, true, "sf");
+ mSFEventThread = new EventThread(sfVsyncSrc);
+ mEventQueue.setEventThread(mSFEventThread);
+
// Initialize the H/W composer object. There may or may not be an
// actual hardware composer underneath.
mHwc = DisplayUtils::getInstance()->getHWCInstance(this,
@@ -504,15 +516,6 @@ void SurfaceFlinger::init() {
// (which may happens before we render something)
getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext);
- // start the EventThread
- sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
- vsyncPhaseOffsetNs, true, "app");
- mEventThread = new EventThread(vsyncSrc);
- sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
- sfVsyncPhaseOffsetNs, true, "sf");
- mSFEventThread = new EventThread(sfVsyncSrc);
- mEventQueue.setEventThread(mSFEventThread);
-
mEventControlThread = new EventControlThread(this);
mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY);
android_set_rt_ioprio(mEventControlThread->getTid(), 1);
@@ -641,6 +644,7 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
info.ydpi = ydpi;
info.fps = float(1e9 / hwConfig.refresh);
info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;
+ info.colorTransform = hwConfig.colorTransform;
// This is how far in advance a buffer must be queued for
// presentation at a given time. If you want a buffer to appear
@@ -934,12 +938,31 @@ bool SurfaceFlinger::handleMessageInvalidate() {
void SurfaceFlinger::handleMessageRefresh() {
ATRACE_CALL();
- preComposition();
- rebuildLayerStacks();
- setUpHWComposer();
- doDebugFlashRegions();
- doComposition();
- postComposition();
+
+ static nsecs_t previousExpectedPresent = 0;
+ nsecs_t expectedPresent = mPrimaryDispSync.computeNextRefresh(0);
+ static bool previousFrameMissed = false;
+ bool frameMissed = (expectedPresent == previousExpectedPresent);
+ if (frameMissed != previousFrameMissed) {
+ ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
+ }
+ previousFrameMissed = frameMissed;
+
+ if (CC_UNLIKELY(mDropMissedFrames && frameMissed)) {
+ // Latch buffers, but don't send anything to HWC, then signal another
+ // wakeup for the next vsync
+ preComposition();
+ repaintEverything();
+ } else {
+ preComposition();
+ rebuildLayerStacks();
+ setUpHWComposer();
+ doDebugFlashRegions();
+ doComposition();
+ postComposition();
+ }
+
+ previousExpectedPresent = mPrimaryDispSync.computeNextRefresh(0);
}
void SurfaceFlinger::doDebugFlashRegions()
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 9da0bd8..4bbb1f4 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -489,6 +489,7 @@ private:
RenderEngine* mRenderEngine;
nsecs_t mBootTime;
bool mGpuToCpuSupported;
+ bool mDropMissedFrames;
sp<EventThread> mEventThread;
sp<EventThread> mSFEventThread;
sp<EventControlThread> mEventControlThread;