From c080030e715082f7a910066bbcd8cc7a3a8500eb Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Wed, 5 Aug 2020 12:50:03 -0700 Subject: Fix refresh rate callback fan-out for choreographer * AChoreographer receives refresh rates from DisplayManager already, so there's no need to default-enable them - AChoreographer only needs to pump an event with the latest refresh rate to wake up looper. This also ensures that AChoreographer's callbacks are entirely in-sync with DisplayManager since there's no raciness. * Instead of re-requesting a config change from SF, instead inject it in AChoreographer correctly to save on binder. Bug: 154874011 Bug: 158680912 Bug: 161406626 Test: while [ true ]; do adb shell service call SurfaceFlinger 1035 i32 1; adb shell service call SurfaceFlinger 1035 i32 0; and repeatedly rotate the home screen with auto-rotate off. Change-Id: I66abc2e28e60f06987ce3a54be294c94b77524fc Merged-In: I66abc2e28e60f06987ce3a54be294c94b77524fc --- libs/gui/BitTube.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libs/gui/BitTube.cpp') diff --git a/libs/gui/BitTube.cpp b/libs/gui/BitTube.cpp index ef7a6f54d9..351af652e2 100644 --- a/libs/gui/BitTube.cpp +++ b/libs/gui/BitTube.cpp @@ -86,6 +86,10 @@ void BitTube::setReceiveFd(base::unique_fd&& receiveFd) { mReceiveFd = std::move(receiveFd); } +void BitTube::setSendFd(base::unique_fd&& sendFd) { + mSendFd = std::move(sendFd); +} + ssize_t BitTube::write(void const* vaddr, size_t size) { ssize_t err, len; do { @@ -115,6 +119,11 @@ status_t BitTube::writeToParcel(Parcel* reply) const { status_t result = reply->writeDupFileDescriptor(mReceiveFd); mReceiveFd.reset(); + if (result != NO_ERROR) { + return result; + } + result = reply->writeDupFileDescriptor(mSendFd); + mSendFd.reset(); return result; } @@ -126,6 +135,13 @@ status_t BitTube::readFromParcel(const Parcel* parcel) { ALOGE("BitTube::readFromParcel: can't dup file descriptor (%s)", strerror(error)); return -error; } + mSendFd.reset(dup(parcel->readFileDescriptor())); + if (mSendFd < 0) { + mSendFd.reset(); + int error = errno; + ALOGE("BitTube::readFromParcel: can't dup file descriptor (%s)", strerror(error)); + return -error; + } return NO_ERROR; } -- cgit v1.2.3-59-g8ed1b