From 3c5958f62dbecf5eca10c388e50a6caf4c5682a4 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Fri, 9 Mar 2018 14:10:25 -0800 Subject: No longer print hash for stashed blocks during verification of retry During block verification, load stash reads from the source blocks on the device instead of the stashed files. And for interrupted update, it's pretty common that the source blocks has already been overwritten by subsequent commands. In that case the hash printing is mostly useless. Moreover we should have already printed the hash when the first update failed. Bug: 80241799 Test: Unit tests pass. No longer prints mismatching stashed source blocks on retry. Change-Id: I4effe684280b0325199f6cc4b2cc26e91295c2d7 --- updater/blockimg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3 From 955da1e26dc43ea56c5cd28404145d453ae448ba Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Thu, 7 Jun 2018 10:51:33 -0700 Subject: minui/drm: wait for page flip completion If two consecutive call are made to drmModePageFlip, the second call may fail with -EBUSY because the first flip is not completed yet. This patch adds a wait for completion mechanism based on drmHandleEvent. Change-Id: Ied13ebefc7523003431b1b307bae70d1a70cb24b Signed-off-by: Jeremy Compostella Signed-off-by: Benoit Fradin --- minui/graphics_drm.cpp | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) 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 +#include #include #include #include @@ -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(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]; } -- cgit v1.2.3