do not call Set/DropMaster if not running as root

To support running additional X servers on other VTs, Xorg video drivers
typically drop DRM master when swtiching VTs, and set master when switching
back. However, the DRM_IOCTL_SET/DROP_MASTER ioctls are DRM_ROOT_ONLY, and
thus can not be used when the euid is not 0. We would like armsoc to work in
a X server that is not running as root, however. So, let's only drop/set
master if we know for sure we are running as root.

Note: This allows the X server with armsoc driver to run as non-root, but
running additional X servers in parallel on other VTs will not work. Starting
an X server as root will work as before.

BUG=chromium:182119
TEST=build and run Chrome OS for daisy, run smoke
also try same with CL:177412

Change-Id: I51b60b1ff06d273c7a3c5433f60d82596a498b8a
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177402
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
1 file changed