vulkan/wsi: check if the display_fd given is master
authorEmil Velikov <emil.velikov@collabora.com>
Wed, 17 Apr 2019 16:49:09 +0000 (17:49 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 26 Apr 2019 10:26:33 +0000 (11:26 +0100)
commitc962a78f18284e2971301bf68c9c60500ca398e4
treec0fae82ce429b35c9503787bdeba355ea067a02f
parent1a9367c13455e6ecff39ec04351d557cf5cf59e4
vulkan/wsi: check if the display_fd given is master

As effectively required by the extension, we need to ensure we're master

Currently drivers employ vendor specific solutions, which check if the
device behind the fd is capable*, yet none of them do the master check.

*In the radv case, if acceleration is available.

Instead of duplicating the check in each driver, keep it where it's
needed and used.

Note this copies libdrm's drmIsMaster() to avoid depending on bleeding
edge version of the library.

v2: set the fd to -1 if not master (Bas)

Fixes: da997ebec92 ("vulkan: Add KHR_display extension using DRM [v10]")
Cc: Andres Rodriguez <andresx7@gmail.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Keith Packard <keithp@keithp.com>
Reported-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
src/vulkan/wsi/wsi_common_display.c