summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-07-06 05:01:50 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-07-06 05:01:50 +0200
commitfcf96485488cf3a199d8d909d3f5894c5900b00e (patch)
tree2d34688f8c82c24b05ee493748aa00506a130efd
parentSnap for 4869171 from c3701ea992f7421f7d4cf78184b765e178c63707 to qt-release (diff)
parentMerge "minui/drm: wait for page flip completion" am: d419966730 am: d3e023c265 (diff)
downloadandroid_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.tar
android_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.tar.gz
android_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.tar.bz2
android_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.tar.lz
android_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.tar.xz
android_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.tar.zst
android_bootable_recovery-fcf96485488cf3a199d8d909d3f5894c5900b00e.zip
-rw-r--r--minui/graphics_drm.cpp39
-rw-r--r--updater/blockimg.cpp4
2 files changed, 41 insertions, 2 deletions
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp
index 4c98507f6..57912d1e8 100644
--- a/minui/graphics_drm.cpp
+++ b/minui/graphics_drm.cpp
@@ -17,6 +17,7 @@
#include "graphics_drm.h"
#include <fcntl.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
@@ -378,13 +379,49 @@ GRSurface* MinuiBackendDrm::Init() {
return GRSurfaceDrms[0];
}
+static void page_flip_complete(__unused int fd,
+ __unused unsigned int sequence,
+ __unused unsigned int tv_sec,
+ __unused unsigned int tv_usec,
+ void *user_data) {
+ *static_cast<bool*>(user_data) = false;
+}
+
GRSurface* MinuiBackendDrm::Flip() {
+ bool ongoing_flip = true;
+
int ret = drmModePageFlip(drm_fd, main_monitor_crtc->crtc_id,
- GRSurfaceDrms[current_buffer]->fb_id, 0, nullptr);
+ GRSurfaceDrms[current_buffer]->fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT, &ongoing_flip);
if (ret < 0) {
printf("drmModePageFlip failed ret=%d\n", ret);
return nullptr;
}
+
+ while (ongoing_flip) {
+ struct pollfd fds = {
+ .fd = drm_fd,
+ .events = POLLIN
+ };
+
+ ret = poll(&fds, 1, -1);
+ if (ret == -1 || !(fds.revents & POLLIN)) {
+ printf("poll() failed on drm fd\n");
+ break;
+ }
+
+ drmEventContext evctx = {
+ .version = DRM_EVENT_CONTEXT_VERSION,
+ .page_flip_handler = page_flip_complete
+ };
+
+ ret = drmHandleEvent(drm_fd, &evctx);
+ if (ret != 0) {
+ printf("drmHandleEvent failed ret=%d\n", ret);
+ break;
+ }
+ }
+
current_buffer = 1 - current_buffer;
return GRSurfaceDrms[current_buffer];
}
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index cdf24f8b1..937c5e14b 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -765,7 +765,9 @@ static int LoadStash(const CommandParameters& params, const std::string& id, boo
}
if (VerifyBlocks(id, *buffer, src.blocks(), true) != 0) {
LOG(ERROR) << "failed to verify loaded source blocks in stash map.";
- PrintHashForCorruptedStashedBlocks(id, *buffer, src);
+ if (!is_retry) {
+ PrintHashForCorruptedStashedBlocks(id, *buffer, src);
+ }
return -1;
}
return 0;