summaryrefslogtreecommitdiff
path: root/libs/gui/ScreenCaptureResults.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2021-01-27 20:27:23 -0800
committer Ady Abraham <adyabr@google.com> 2021-01-29 18:03:58 +0000
commit99599940f68158aeef735d8763980d0dbd397b51 (patch)
treeb8620b3a33b7d51223a4a22707d1bab2669de793 /libs/gui/ScreenCaptureResults.cpp
parent31999efbac943af5c43c64a6929d5fe5857c6532 (diff)
SurfaceFlinger: move sync_wait for screen capture to client
Free up time from the SF's main thread by moving the fence waiting to the client. Test: Observe systrace of region sample thread Test: adb shell screencap Test: Recents takes the screenshot Test: Rotate device Test: Volume + power down for screenshot Bug: 178649983 Change-Id: I0a4991c013375b1f354e0728a06ca30a835b0422
Diffstat (limited to 'libs/gui/ScreenCaptureResults.cpp')
-rw-r--r--libs/gui/ScreenCaptureResults.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/gui/ScreenCaptureResults.cpp b/libs/gui/ScreenCaptureResults.cpp
index 2b29487268..f3849bcdcd 100644
--- a/libs/gui/ScreenCaptureResults.cpp
+++ b/libs/gui/ScreenCaptureResults.cpp
@@ -25,6 +25,14 @@ status_t ScreenCaptureResults::writeToParcel(android::Parcel* parcel) const {
} else {
SAFE_PARCEL(parcel->writeBool, false);
}
+
+ if (fence != Fence::NO_FENCE) {
+ SAFE_PARCEL(parcel->writeBool, true);
+ SAFE_PARCEL(parcel->write, *fence);
+ } else {
+ SAFE_PARCEL(parcel->writeBool, false);
+ }
+
SAFE_PARCEL(parcel->writeBool, capturedSecureLayers);
SAFE_PARCEL(parcel->writeUint32, static_cast<uint32_t>(capturedDataspace));
SAFE_PARCEL(parcel->writeInt32, result);
@@ -39,6 +47,13 @@ status_t ScreenCaptureResults::readFromParcel(const android::Parcel* parcel) {
SAFE_PARCEL(parcel->read, *buffer);
}
+ bool hasFence;
+ SAFE_PARCEL(parcel->readBool, &hasFence);
+ if (hasFence) {
+ fence = new Fence();
+ SAFE_PARCEL(parcel->read, *fence);
+ }
+
SAFE_PARCEL(parcel->readBool, &capturedSecureLayers);
uint32_t dataspace = 0;
SAFE_PARCEL(parcel->readUint32, &dataspace);