Call DRI2CloseScreen after pScreen->CloseScreen

Both DRI2 and RandR may wrap pScrn functions.  Thus, it is important that
they get closed in the opposite order that they were initialized.

OMAPScreenInit() calls DRI2ScreenInit() before xf86CrtcScreenInit() (which
in turn calls xf86RandR12Init12).

Therefore, OMAPScreenCloseScreen() must unwrap xf86CrtcCloseScreen() and
call it (which in turn calls xf86RandR12CloseScreen) before calling
DRI2CloseScreen.

This should ensure that wrapped function order is correct between DRI2 and
RandR12.

In particular, this fixes the EnterVT handler such that it is correct on
subsequent server generations.

BUG=chromium:265051
TEST=ssh to device
  stop ui
  X :1 &  # start a test X server
  ORIG_VT=`fgconsole` # save original VT
  DISPLAY=:1 xev &    # start a test X client
  kill %2             # kill test X client (causes X server regeneration)
  DISPLAY=:1 xev &    # start a second test X client
  chvt 2              # VT-2 switch
  chvt $ORIG_VT       # switch back to original VT
  => No X server crash

Change-Id: I5665c3452a18bf2009640453f62dda0f33eb215f
Reviewed-on: https://gerrit.chromium.org/gerrit/63552
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
1 file changed