Increment and decrement pending_flips only for flips, not blits
When a display is not flippable, OMAPDRI2ScheduleSwap falls back to
a blit, which causes switch to blit mode, which waits for all flips
to complete based on pending_flips counter which was incremented before
the decision was made whether to flip or fall back to blit causing a
deadlock. This change moves the pending_flips increment after the
decision is made to do the flip and only decrements it for completed
flips not blits.
BUG=chrome-os-partner:23877
TEST=move primary display to HDMI monitor, start playing a video, close
and open lid repeatedly.
Change-Id: Ieccb224ba03e9f863ffc64f2d2a2a091a8bce32e
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175978
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
diff --git a/src/omap_dri2.c b/src/omap_dri2.c
index 5ce5b75..c2db598 100644
--- a/src/omap_dri2.c
+++ b/src/omap_dri2.c
@@ -479,7 +479,9 @@
*/
pScreen->DestroyPixmap(cmd->pSrcPixmap);
pScreen->DestroyPixmap(cmd->pDstPixmap);
- pOMAP->pending_flips--;
+ if (cmd->type != DRI2_BLIT_COMPLETE) {
+ pOMAP->pending_flips--;
+ }
free(cmd);
}
@@ -578,7 +580,6 @@
*/
cmd->pSrcPixmap->refcnt++;
cmd->pDstPixmap->refcnt++;
- pOMAP->pending_flips++;
src_fb_id = omap_bo_get_fb(src_priv->bo);
dst_fb_id = omap_bo_get_fb(dst_priv->bo);
@@ -614,6 +615,7 @@
cmd->type = DRI2_FLIP_COMPLETE;
/* TODO: handle rollback if only multiple CRTC flip is only partially successful
*/
+ pOMAP->pending_flips++;
ret = drmmode_page_flip(pDraw, src_fb_id, cmd, &num_flipped);
/* If using page flip events, we'll trigger an immediate completion in