dri2: update scanouts in SwapComplete even if DRI2Drawable is gone
When a DRI2 client leaves, the DRI2 layer:
(a) unregisters its DRI2Drawable
(b) calls DDX.DRI2Info->DestroyBuffer() on all of its DRI2Buffers
If the DRI2 client leaves after submitting DRI2SwapBuffers, but before
the DDX processes SwapComplete(), then during SwapComplete():
(c) the dixLookupDrawable() will return BadDrawable, and
(d) the cmd->pSrcPixmap and cmd->pDstPixmaps will have already had their
reference counts decremented when their corresponding DRI2Buffer's were
destroyed in (b) above.
Due to (c), SwapComplete() was not updating the scanouts in this scenario.
(e) it wasn't doing Pixmap exchange, so the destination Pixmap didn't
get updated to the source Pixmap's original BO, and
(f) it wasn't updating the per-crtc scanout to point to the destination
Pixmap's new bo (i.e., the old source BO).
Due to (d), when SwapComplete() dropped the extra refcnt on the SrcPixmap
(taken in ScheduleSwap()), it actually ended up dropping the last reference
on the BO that we had just flipped to, and was therefore currently being
scanned out. The omap_bo layer removed its FB, during which the kernel would
dutifully clean up the mess made by user space, by blanking the screen.
As a side-effect, all subsequent page flip requests (on drm/rockchip, at
least) would fail.
In truth, SwapComplete() only needs to skip calling DRI2SwapComplete() if
our DRI2Drawable has gone away. It should still update the Pixmaps and
per-crtc scanouts to ensure that reference count is non-zero for the
Signed-off-by: Daniel Kurtz <firstname.lastname@example.org>
TEST=On pinky-rev2; at login screen, make sure cursor is blinking
Enable ARMSOC Debug Option in /etc/X11/xorg.conf.d/rk32.conf
Click "Browse as Guest" just as the cursor is displayed
Chrome should start (no black screen)
=> If you time it right, /var/log/xorg/Xorg.log should have
"dixLookupDrawable failed: 9"
Reviewed-by: Dominik Behr <email@example.com>
Tested-by: Sonny Rao <firstname.lastname@example.org>
Commit-Queue: Daniel Kurtz <email@example.com>
Trybot-Ready: Daniel Kurtz <firstname.lastname@example.org>
Tested-by: Daniel Kurtz <email@example.com>
1 file changed