summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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
-rw-r--r--services/surfaceflinger/surfaceflinger.rc1
7 files changed, 70 insertions, 21 deletions
diff --git a/services/batteryservice/BatteryProperties.cpp b/services/batteryservice/BatteryProperties.cpp
index ab636a9f8..f13d6e8b4 100644
--- a/services/batteryservice/BatteryProperties.cpp
+++ b/services/batteryservice/BatteryProperties.cpp
@@ -33,6 +33,7 @@ status_t BatteryProperties::readFromParcel(Parcel* p) {
33 chargerAcOnline = p->readInt32() == 1 ? true : false; 33 chargerAcOnline = p->readInt32() == 1 ? true : false;
34 chargerUsbOnline = p->readInt32() == 1 ? true : false; 34 chargerUsbOnline = p->readInt32() == 1 ? true : false;
35 chargerWirelessOnline = p->readInt32() == 1 ? true : false; 35 chargerWirelessOnline = p->readInt32() == 1 ? true : false;
36 maxChargingCurrent = p->readInt32();
36 batteryStatus = p->readInt32(); 37 batteryStatus = p->readInt32();
37 batteryHealth = p->readInt32(); 38 batteryHealth = p->readInt32();
38 batteryPresent = p->readInt32() == 1 ? true : false; 39 batteryPresent = p->readInt32() == 1 ? true : false;
@@ -47,6 +48,7 @@ status_t BatteryProperties::writeToParcel(Parcel* p) const {
47 p->writeInt32(chargerAcOnline ? 1 : 0); 48 p->writeInt32(chargerAcOnline ? 1 : 0);
48 p->writeInt32(chargerUsbOnline ? 1 : 0); 49 p->writeInt32(chargerUsbOnline ? 1 : 0);
49 p->writeInt32(chargerWirelessOnline ? 1 : 0); 50 p->writeInt32(chargerWirelessOnline ? 1 : 0);
51 p->writeInt32(maxChargingCurrent);
50 p->writeInt32(batteryStatus); 52 p->writeInt32(batteryStatus);
51 p->writeInt32(batteryHealth); 53 p->writeInt32(batteryHealth);
52 p->writeInt32(batteryPresent ? 1 : 0); 54 p->writeInt32(batteryPresent ? 1 : 0);
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index bd74b026e..36095bf1e 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -4699,7 +4699,7 @@ void TouchInputMapper::cookPointerData() {
4699 bottom = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate; 4699 bottom = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate;
4700 top = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate; 4700 top = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate;
4701 orientation -= M_PI_2; 4701 orientation -= M_PI_2;
4702 if (orientation < mOrientedRanges.orientation.min) { 4702 if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
4703 orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min); 4703 orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
4704 } 4704 }
4705 break; 4705 break;
@@ -4711,7 +4711,7 @@ void TouchInputMapper::cookPointerData() {
4711 bottom = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate; 4711 bottom = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate;
4712 top = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate; 4712 top = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate;
4713 orientation -= M_PI; 4713 orientation -= M_PI;
4714 if (orientation < mOrientedRanges.orientation.min) { 4714 if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
4715 orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min); 4715 orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
4716 } 4716 }
4717 break; 4717 break;
@@ -4723,7 +4723,7 @@ void TouchInputMapper::cookPointerData() {
4723 bottom = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; 4723 bottom = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
4724 top = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; 4724 top = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
4725 orientation += M_PI_2; 4725 orientation += M_PI_2;
4726 if (orientation > mOrientedRanges.orientation.max) { 4726 if (mOrientedRanges.haveOrientation && orientation > mOrientedRanges.orientation.max) {
4727 orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min); 4727 orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
4728 } 4728 }
4729 break; 4729 break;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 320899045..d37fcb2b8 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -336,10 +336,20 @@ static const uint32_t DISPLAY_ATTRIBUTES[] = {
336 HWC_DISPLAY_HEIGHT, 336 HWC_DISPLAY_HEIGHT,
337 HWC_DISPLAY_DPI_X, 337 HWC_DISPLAY_DPI_X,
338 HWC_DISPLAY_DPI_Y, 338 HWC_DISPLAY_DPI_Y,
339 HWC_DISPLAY_COLOR_TRANSFORM,
339 HWC_DISPLAY_NO_ATTRIBUTE, 340 HWC_DISPLAY_NO_ATTRIBUTE,
340}; 341};
341#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0]) 342#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0])
342 343
344static const uint32_t PRE_HWC15_DISPLAY_ATTRIBUTES[] = {
345 HWC_DISPLAY_VSYNC_PERIOD,
346 HWC_DISPLAY_WIDTH,
347 HWC_DISPLAY_HEIGHT,
348 HWC_DISPLAY_DPI_X,
349 HWC_DISPLAY_DPI_Y,
350 HWC_DISPLAY_NO_ATTRIBUTE,
351};
352
343status_t HWComposer::queryDisplayProperties(int disp) { 353status_t HWComposer::queryDisplayProperties(int disp) {
344 354
345 LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)); 355 LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1));
@@ -362,6 +372,12 @@ status_t HWComposer::queryDisplayProperties(int disp) {
362 for (size_t c = 0; c < numConfigs; ++c) { 372 for (size_t c = 0; c < numConfigs; ++c) {
363 err = mHwc->getDisplayAttributes(mHwc, disp, configs[c], 373 err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
364 DISPLAY_ATTRIBUTES, values); 374 DISPLAY_ATTRIBUTES, values);
375 // If this is a pre-1.5 HWC, it may not know about color transform, so
376 // try again with a smaller set of attributes
377 if (err != NO_ERROR) {
378 err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
379 PRE_HWC15_DISPLAY_ATTRIBUTES, values);
380 }
365 if (err != NO_ERROR) { 381 if (err != NO_ERROR) {
366 // we can't get this display's info. turn it off. 382 // we can't get this display's info. turn it off.
367 mDisplayData[disp].connected = false; 383 mDisplayData[disp].connected = false;
@@ -386,6 +402,9 @@ status_t HWComposer::queryDisplayProperties(int disp) {
386 case HWC_DISPLAY_DPI_Y: 402 case HWC_DISPLAY_DPI_Y:
387 config.ydpi = values[i] / 1000.0f; 403 config.ydpi = values[i] / 1000.0f;
388 break; 404 break;
405 case HWC_DISPLAY_COLOR_TRANSFORM:
406 config.colorTransform = values[i];
407 break;
389 default: 408 default:
390 ALOG_ASSERT(false, "unknown display attribute[%zu] %#x", 409 ALOG_ASSERT(false, "unknown display attribute[%zu] %#x",
391 i, DISPLAY_ATTRIBUTES[i]); 410 i, DISPLAY_ATTRIBUTES[i]);
@@ -1147,9 +1166,11 @@ void HWComposer::dump(String8& result) const {
1147 result.appendFormat(" Display[%zd] configurations (* current):\n", i); 1166 result.appendFormat(" Display[%zd] configurations (* current):\n", i);
1148 for (size_t c = 0; c < disp.configs.size(); ++c) { 1167 for (size_t c = 0; c < disp.configs.size(); ++c) {
1149 const DisplayConfig& config(disp.configs[c]); 1168 const DisplayConfig& config(disp.configs[c]);
1150 result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, refresh=%" PRId64 "\n", 1169 result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f"
1151 c == disp.currentConfig ? "* " : "", c, config.width, config.height, 1170 ", refresh=%" PRId64 ", colorTransform=%d\n",
1152 config.xdpi, config.ydpi, config.refresh); 1171 c == disp.currentConfig ? "* " : "", c,
1172 config.width, config.height, config.xdpi, config.ydpi,
1173 config.refresh, config.colorTransform);
1153 } 1174 }
1154 1175
1155 if (disp.list) { 1176 if (disp.list) {
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index cc98b4c20..5e0b3d85e 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -257,6 +257,7 @@ public:
257 float xdpi; 257 float xdpi;
258 float ydpi; 258 float ydpi;
259 nsecs_t refresh; 259 nsecs_t refresh;
260 int colorTransform;
260 }; 261 };
261 262
262 // Query display parameters. Pass in a display index (e.g. 263 // Query display parameters. Pass in a display index (e.g.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index de0f921e2..fdc36505c 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -163,6 +163,9 @@ SurfaceFlinger::SurfaceFlinger()
163 property_get("ro.bq.gpu_to_cpu_unsupported", value, "0"); 163 property_get("ro.bq.gpu_to_cpu_unsupported", value, "0");
164 mGpuToCpuSupported = !atoi(value); 164 mGpuToCpuSupported = !atoi(value);
165 165
166 property_get("debug.sf.drop_missed_frames", value, "0");
167 mDropMissedFrames = atoi(value);
168
166 property_get("debug.sf.showupdates", value, "0"); 169 property_get("debug.sf.showupdates", value, "0");
167 mDebugRegion = atoi(value); 170 mDebugRegion = atoi(value);
168 171
@@ -442,6 +445,15 @@ void SurfaceFlinger::init() {
442 mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); 445 mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
443 eglInitialize(mEGLDisplay, NULL, NULL); 446 eglInitialize(mEGLDisplay, NULL, NULL);
444 447
448 // start the EventThread
449 sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
450 vsyncPhaseOffsetNs, true, "app");
451 mEventThread = new EventThread(vsyncSrc);
452 sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
453 sfVsyncPhaseOffsetNs, true, "sf");
454 mSFEventThread = new EventThread(sfVsyncSrc);
455 mEventQueue.setEventThread(mSFEventThread);
456
445 // Initialize the H/W composer object. There may or may not be an 457 // Initialize the H/W composer object. There may or may not be an
446 // actual hardware composer underneath. 458 // actual hardware composer underneath.
447 mHwc = new HWComposer(this, 459 mHwc = new HWComposer(this,
@@ -493,15 +505,6 @@ void SurfaceFlinger::init() {
493 // (which may happens before we render something) 505 // (which may happens before we render something)
494 getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext); 506 getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext);
495 507
496 // start the EventThread
497 sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
498 vsyncPhaseOffsetNs, true, "app");
499 mEventThread = new EventThread(vsyncSrc);
500 sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
501 sfVsyncPhaseOffsetNs, true, "sf");
502 mSFEventThread = new EventThread(sfVsyncSrc);
503 mEventQueue.setEventThread(mSFEventThread);
504
505 mEventControlThread = new EventControlThread(this); 508 mEventControlThread = new EventControlThread(this);
506 mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY); 509 mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY);
507 510
@@ -629,6 +632,7 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
629 info.ydpi = ydpi; 632 info.ydpi = ydpi;
630 info.fps = float(1e9 / hwConfig.refresh); 633 info.fps = float(1e9 / hwConfig.refresh);
631 info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS; 634 info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;
635 info.colorTransform = hwConfig.colorTransform;
632 636
633 // This is how far in advance a buffer must be queued for 637 // This is how far in advance a buffer must be queued for
634 // presentation at a given time. If you want a buffer to appear 638 // presentation at a given time. If you want a buffer to appear
@@ -919,12 +923,31 @@ bool SurfaceFlinger::handleMessageInvalidate() {
919 923
920void SurfaceFlinger::handleMessageRefresh() { 924void SurfaceFlinger::handleMessageRefresh() {
921 ATRACE_CALL(); 925 ATRACE_CALL();
922 preComposition(); 926
923 rebuildLayerStacks(); 927 static nsecs_t previousExpectedPresent = 0;
924 setUpHWComposer(); 928 nsecs_t expectedPresent = mPrimaryDispSync.computeNextRefresh(0);
925 doDebugFlashRegions(); 929 static bool previousFrameMissed = false;
926 doComposition(); 930 bool frameMissed = (expectedPresent == previousExpectedPresent);
927 postComposition(); 931 if (frameMissed != previousFrameMissed) {
932 ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
933 }
934 previousFrameMissed = frameMissed;
935
936 if (CC_UNLIKELY(mDropMissedFrames && frameMissed)) {
937 // Latch buffers, but don't send anything to HWC, then signal another
938 // wakeup for the next vsync
939 preComposition();
940 repaintEverything();
941 } else {
942 preComposition();
943 rebuildLayerStacks();
944 setUpHWComposer();
945 doDebugFlashRegions();
946 doComposition();
947 postComposition();
948 }
949
950 previousExpectedPresent = mPrimaryDispSync.computeNextRefresh(0);
928} 951}
929 952
930void SurfaceFlinger::doDebugFlashRegions() 953void SurfaceFlinger::doDebugFlashRegions()
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 3759a9240..b3baadd46 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -445,6 +445,7 @@ private:
445 RenderEngine* mRenderEngine; 445 RenderEngine* mRenderEngine;
446 nsecs_t mBootTime; 446 nsecs_t mBootTime;
447 bool mGpuToCpuSupported; 447 bool mGpuToCpuSupported;
448 bool mDropMissedFrames;
448 sp<EventThread> mEventThread; 449 sp<EventThread> mEventThread;
449 sp<EventThread> mSFEventThread; 450 sp<EventThread> mSFEventThread;
450 sp<EventControlThread> mEventControlThread; 451 sp<EventControlThread> mEventControlThread;
diff --git a/services/surfaceflinger/surfaceflinger.rc b/services/surfaceflinger/surfaceflinger.rc
index 718b6b65f..59a43e219 100644
--- a/services/surfaceflinger/surfaceflinger.rc
+++ b/services/surfaceflinger/surfaceflinger.rc
@@ -3,3 +3,4 @@ service surfaceflinger /system/bin/surfaceflinger
3 user system 3 user system
4 group graphics drmrpc 4 group graphics drmrpc
5 onrestart restart zygote 5 onrestart restart zygote
6 writepid /dev/cpuset/system-background/tasks