Commit Graph

8119 Commits

Author SHA1 Message Date
Jeremy Huddleston Sequoia 8890c44a75 xquartz: Remove a check for NSAppKitVersionNumber >= NSAppKitVersionNumber10_7
This check is always true on our supported systems.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5ae47a9d579e8cb0fbe938455faea53ed75d7098)
2021-02-22 09:22:32 -08:00
Jeremy Huddleston Sequoia 3c3680c366 xquartz: Don't include strndup.c any more since we no longer support 10.8 and older
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit b960675257d301605def6008bddcccb0980a3c4c)
2021-02-22 09:22:32 -08:00
Jeremy Huddleston Sequoia e1fdc856ae xquartz: Add a launch trampoline to better integrate with modern versions of macOS
Fixes: https://github.com/XQuartz/XQuartz/issues/6
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 694724e42c4a3eadb32891220084b03504f9586b)
2021-02-22 09:22:32 -08:00
Jeremy Huddleston Sequoia 8f8e9c53e7 xquartz: Don't process AppKit events if we haven't finished initializing
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 25035229b7)
2021-02-20 21:06:15 -08:00
Jeremy Huddleston Sequoia aa6f84021a xquartz: Allocate each fbconfig separately
A change during the 1.20 development cycle resulted in fbconfigs being walked
and deallocated individually during __glXScreenDestroy.  This change
now avoids a use-after-free caused by that change.

==50859==ERROR: AddressSanitizer: heap-use-after-free on address 0x00010d3819c8 at pc 0x0001009d4230 bp 0x00016feca7a0 sp 0x00016feca798
READ of size 8 at 0x00010d3819c8 thread T5
    #0 0x1009d422c in __glXScreenDestroy glxscreens.c:448
    #1 0x10091cc98 in __glXAquaScreenDestroy indirect.c:510
    #2 0x1009d2734 in glxCloseScreen glxscreens.c:169
    #3 0x100740a24 in dix_main main.c:325
    #4 0x10023ed50 in server_thread quartzStartup.c:65
    #5 0x199ae7fd0 in _pthread_start+0x13c (libsystem_pthread.dylib:arm64e+0x6fd0)
    #6 0x199ae2d38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d38)

0x00010d3819c8 is located 200 bytes inside of 12800-byte region [0x00010d381900,0x00010d384b00)
freed by thread T5 here:
    #0 0x101477ba8 in wrap_free+0x98 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3fba8)
    #1 0x1009d4240 in __glXScreenDestroy glxscreens.c:449
    #2 0x10091cc98 in __glXAquaScreenDestroy indirect.c:510
    #3 0x1009d2734 in glxCloseScreen glxscreens.c:169
    #4 0x100740a24 in dix_main main.c:325
    #5 0x10023ed50 in server_thread quartzStartup.c:65
    #6 0x199ae7fd0 in _pthread_start+0x13c (libsystem_pthread.dylib:arm64e+0x6fd0)
    #7 0x199ae2d38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d38)

previously allocated by thread T5 here:
    #0 0x101477e38 in wrap_calloc+0x9c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3fe38)
    #1 0x100925a40 in __glXAquaCreateVisualConfigs visualConfigs.c:116
    #2 0x10091cb24 in __glXAquaScreenProbe+0x224 (X11.bin:arm64+0x100730b24)
    #3 0x1009cd840 in xorgGlxServerInit glxext.c:528
    #4 0x10074539c in _CallCallbacks dixutils.c:743
    #5 0x100932a70 in CallCallbacks callback.h:83
    #6 0x100932478 in GlxExtensionInit vndext.c:244
    #7 0x10020a364 in InitExtensions miinitext.c:267
    #8 0x10073fe7c in dix_main main.c:197
    #9 0x10023ed50 in server_thread quartzStartup.c:65
    #10 0x199ae7fd0 in _pthread_start+0x13c (libsystem_pthread.dylib:arm64e+0x6fd0)
    #11 0x199ae2d38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d38)

Regressed-in: 4b0a3cbab1
CC: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 487286d472)
2021-02-20 17:30:45 -08:00
Jeremy Huddleston Sequoia 7aa51bb572 xquartz: Fix a compiler warning about const incompatible pointer assignment
driWrap.c:541:30: error: assigning to 'GCOps *' (aka 'struct _GCOps *') from 'const GCOps *' (aka 'const struct _GCOps *') discards
      qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        pGCPriv->originalOps = pGC->ops;
                             ^ ~~~~~~~~

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 6a83fb51b7)
2021-02-20 15:21:37 -08:00
Jeremy Huddleston Sequoia d751c46bd7 xquartz: Fix build with sparkle enabled
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit a3ddcdd56c)
2021-02-19 16:33:04 -08:00
Jeremy Huddleston Sequoia 03c2e12a82 xquartz: Silence a compiler warning about missing internal methods on NSApplication
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 279bcbd9cf)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia fcbd57367e xquartz: Rewrite Window menu handling to not depend on X11App.windowsMenu.numberOfItems being correct in -awakeFromNib
Fixes: https://github.com/XQuartz/XQuartz/issues/56
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit fe89c70e47)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia b27c6602b3 xquartz: Convert X11Controller ivars into @properties
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 41aed8f696)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 625c7e4dec xquartz: Convert X11Application ivars into @properties
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit c2750e1fab)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 3017fec605 xquartz: Fold quartzCommon.h into quartz.h
Everything declared in it comes from quartz.c, so match reality.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit f51b97b0de)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia bdaff44f98 xquartz: Fold away some unnecessary hops to X11Controller through X11Application
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 4b4500c48f)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 7d22031a6b xquartz: Fold away array_with_strings_and_numbers and simplify with more modern Objective-C
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 39c0e1c0ab)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 937b63ff44 xqaurtz: Remove message_kit_thread() and use dispatch instead
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 87f8fe1f74)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia e531d3a4cb xquartz: Use objc_autoreleasePoolPush / objc_autoreleasePoolPop directly in QuartzBlockHandler
It violates @autoreleasepool best practices, and this helps collapse quartzCocoa.m into quartz.c

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 94e4e17348)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 08cf6c90fd xquartz: Minor code modernization -- @autoreleasepool adoption
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit fba421f700)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 26e0c59a97 xquartz: Remove some dead code for compatibility with older nibs
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 318f8a4a8a)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 2853f38965 xquartz: Remove a workaround for AppKit versions older than Lion
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 72a39dccf9)
2021-02-18 22:35:03 -08:00
Jeremy Huddleston Sequoia 1edc9b980b xquartz: Apply spell check fixes from master for easier cherry-picking of changes in xquartz
See also: 23e83724df
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-18 22:26:08 -08:00
Jeremy Huddleston Sequoia 67f25cc187 xquartz: Fix applications menu table background color for dark mode
Fixes: https://github.com/XQuartz/XQuartz/issues/32
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 7e28750358)
2021-02-17 16:27:03 -08:00
Jeremy Huddleston Sequoia 4028c2ad14 xquartz: Apply Xcode 12.4 automatic updates to nibs
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 85beee9885)
2021-02-17 16:27:00 -08:00
Jeremy Huddleston Sequoia ff1c8e2f72 xquartz: Update the about box copyright to 2021
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 4e892aa6e1)
2021-02-17 13:38:49 -08:00
Jeremy Huddleston Sequoia a16df60284 xquartz: Ensure we call into TIS on the main thread
There is a place where this code was called on the main thread.

We're using a rather nasty anti-pattern to just call a block inline rather
than synchonously calling it on the main thread if we're already on the main
thread.  This code could use a good overhaul, but I don't have time to rip
it apart right now.  This will address the immediate issue.

Fixes: https://github.com/XQuartz/XQuartz/issues/40
Fixes: https://github.com/XQuartz/XQuartz/issues/48
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit c9a3b14c14)
2021-02-17 09:56:15 -08:00
Jeremy Huddleston Sequoia 2087b7782c xquartz: Ensure that NSRunAlertPanel() is run on the main thread
Fixes: https://github.com/XQuartz/XQuartz/issues/30
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 520e7a1310)
2021-02-01 23:10:35 -08:00
Jeremy Huddleston Sequoia 2fe5bf4bad xquartz: Remove support for older versions of libXplugin
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 7d0bb7ed06)
2021-02-01 23:10:35 -08:00
Jeremy Huddleston Sequoia bc1a2a0d83 xquartz: Remove unused include of AvailabilityMacros.h from various sources
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5e7c0762e6)
2021-02-01 23:10:35 -08:00
Jeremy Huddleston Sequoia 393da8b439 xquartz: Remove support for building for i386
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 59f22341a8)
2021-02-01 23:10:32 -08:00
Jeremy Huddleston Sequoia 43aaa10931 xquartz: Remove support for Mountain Lion and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit aea15a7659)
2021-02-01 23:09:54 -08:00
Jeremy Huddleston Sequoia fb492686d7 xquartz: Remove support for Lion and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit c0b2d3e099)
2021-02-01 23:09:54 -08:00
Jeremy Huddleston Sequoia 34784415ad xquartz: Remove support for SnowLeopard and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit cc9cf6f085)
2021-02-01 23:09:54 -08:00
Jeremy Huddleston Sequoia d3f81ecaf9 xquartz: Remove check for libdispatch now that we don't support pre-SnowLeopard
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit f699aac2ea)
2021-02-01 23:09:54 -08:00
Jeremy Huddleston Sequoia 739c5bd32f xquartz: Remove support for Leopard and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5ad4910272)
2021-02-01 23:09:54 -08:00
Jeremy Huddleston Sequoia 2d7eb82499 xquartz: Remove support for Tiger and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 6e6db055f8)
2021-02-01 23:09:52 -08:00
Jeremy Huddleston Sequoia be9d2fd871 xquartz: Remove support for Panther and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 74aef85bd8)
2021-02-01 23:07:26 -08:00
Jim DeLaHunt d39eb58409 Fix typo "XQaurtz" in Xquartz.man
(cherry picked from commit 0e272ac458)
2021-02-01 23:07:11 -08:00
Christopher Chavez 1f2b73176f XQuartz: recognize F16-F20 and Menu keys
Signed-off-by: Christopher Chavez <chrischavez@gmx.us>
(cherry picked from commit 462beb5338)
2021-02-01 23:06:42 -08:00
Jon Turney ecc4ebf535 xquartz: Add stub ddxInputThread()
Omitted from 4ad21c32

(cherry picked from commit f013979507)
2021-01-27 14:43:48 -08:00
Mariusz Ceier b09f5f42dc xwayland: Replace LogMessage with LogMessageVerb
LogMessage logs only when the XLOG_VERBOSITY is >= 1, but by default
XLOG_VERBOSITY is 0.

Signed-off-by: Mariusz Ceier <mceier+freedesktop@gmail.com>
(cherry picked from commit 95539ab37b)
2020-12-16 10:14:12 +01:00
Kishore Kadiyala 54f9af1c61 modesetting: keep going if a modeset fails on EnterVT
There was a time when setting a mode on a CRTC would not depend on the
associated connector's state. If a mode had been set successfully once,
it would mean it would work later on.

This changed with the introduction of new connectors type that now
require a link training sequence (DP, HDMI 2.0), and that means that
some events may have happened while the X server was not master that
would then prevent the mode from successfully be restored to its
previous state.

This patch relaxes the requirement that all modes should be restored on
EnterVT, or the entire X-Server would go down by allowing modesets to
fail (with some warnings). If a modeset fails, the CRTC will be
disabled, and a RandR event will be sent for the desktop environment to
fix the situation as well as possible.

Additional patches might be needed to make sure that the user would
never be left with all screens black in some scenarios.

v2 (Martin Peres):
 - whitespace fixes
 - remove the uevent handling (it is done in a previous patch)
 - improve the commit message
 - reduce the size of the patch by not changing lines needlessly
 - return FALSE if one modeset fails in ignore mode
 - add comments/todos to explain why we do things
 - disable the CRTCs that failed the modeset

Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
Closes: #1010
(cherry picked from commit efb3abddd4)
2020-12-01 11:13:51 +01:00
Martin Peres bd0f53725b modesetting: check the kms state on EnterVT
Normally, we would receive a uevent coming from Linux's DRM subsystem,
which would trigger the check for disappearing/appearing resources.
However, this event is not received when X is not master (another VT
is selected), and so the userspace / desktop environment would not be
notified about the changes that happened while X wasn't master.

To fix the issue, this patch forces a refresh on EnterVT by splitting
the kms-checking code from the uevent handling into its own (exported)
function called drmmode_update_kms_state. This function is then called
from both the uevent-handling function, and on EnterVT right before
restoring the modes.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
Tested-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
(cherry picked from commit 293cf660c9)
2020-12-01 11:10:34 +01:00
Olivier Fourdan 253569a3d2 xwayland: Create an xwl_window for toplevel only
One general assumption in Xwayland is that the xwl_window remains the
same for all the child windows of the toplevel window.

When mapping a new X11 window, ensure_surface_for_window() checks for an
existing xwl_window by using xwl_window_get() which will just check for
the registered xwl_window for the window.

That means that a client mapping a child window of an existing window
with a xwl_window will get another different xwl_window.

If an X11 client issues a Present request on the parent window, hence
placed underneath its child window of the same size, the Wayland
compositor may not send the frame callback event for the parent's
Wayland surface which is reckoned to be not visible, obscured behind
the other Wayland surface for the child X11 window.

That bug affects some games running in wine which may get 1 fps because
the repaint occurs only on timeout with a long interval (as with, e.g.
https://bugs.winehq.org/show_bug.cgi?id=47066)

Fix ensure_surface_for_window() by using xwl_window_from_window() which
will walk the window tree, so that a child window won't get another
xwl_window than its parent.

https://gitlab.freedesktop.org/xorg/xserver/-/issues/1099
See-also: https://bugs.winehq.org/show_bug.cgi?id=47066
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
(cherry picked from commit 606ba7fc51)
2020-11-09 11:35:30 +01:00
Olivier Fourdan 0811a9ff78 xwayland: non-rootless requires the wl_shell protocol
When running non-rootless, Xwayland requires that the Wayland compositor
supports the wl_shell protocol.

Check for wl_shell protocol support at startup and exit cleanly if
missing rather than segfaulting later in ensure_surface_for_window()
while trying to use wl_shell_get_shell_surface().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
(cherry picked from commit ffd02d9b26)
2020-11-09 11:35:30 +01:00
Olivier Fourdan 1930ed233f xwayland: Remove pending stream reference when freeing
The EGLStream backend keeps a queue of pending streams for each Xwayland
window.

However, when this pending queue is freed, the corresponding private
data may not be cleared (typically if the pixmap for this window has
changed before the compositor finished attaching the consumer for the
window's pixmap's original eglstream), leading to a use-after-free and a
crash when trying to use that data as the window pixmap.

Make sure to clear the private data when the pending stream is freed.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1055
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Karol Szuster <karolsz9898@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit a5f439dcd2)
2020-10-01 08:29:01 +00:00
Greg V 1ac389dda8 xwayland: use drmGetNodeTypeFromFd for checking if a node is a render one
Major/minor numbers are a.. major (ha) source of pain in FreeBSD porting.
In this case, Xwayland was thinking that /dev/dri/card0 is already a render node,
because the st_rdev on FreeBSD was passing the Linux-style check,
and because of the assumption, acceleration would fail because
various ioctls like AMDGPU_INFO would be denied on the non-render node.

Switch to libdrm's function that already works correctly on all platforms.

Signed-off-by: Greg V <greg@unrelenting.technology>
Reviewed-by: Emmanuel Vadot <manu@FreeBSD.org>
(cherry picked from commit 239ebdc9e4)
2020-10-01 08:29:01 +00:00
Olivier Fourdan d108c2c82c xwayland: Do not discard frame callbacks on allow commits
Currently, when a X11 client (usually the X11 window manager from a
Wayland compositor) changes the value of the X11 property
`_XWAYLAND_ALLOW_COMMITS` from `false` to `true`, all pending frame
callbacks on the window are discarded so that the commit occurs
immediately.

Weston uses that mechanism to prevent the content of the window from
showing before it's ready when mapping the window initially, but
discarding the pending frame callbacks has no effect on the initial
mapping of the X11 window since at that point there cannot be any frame
callback on a surface which hasn't been committed yet anyway.

However, discarding pending frame callbacks can be problematic if we
were to use the same `_XWAYLAND_ALLOW_COMMITS` mechanism to prevent
damages to be posted before the X11 toplevel is updated completely
(including the window decorations from the X11 window manager).

Remove the portion of code discarding the pending frame callback,
Xwayland should always wait for a pending frame callback if there's one
before posting new damages.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/333
(cherry picked from commit 66da95a172)
2020-09-30 15:06:30 +00:00
Michel Dänzer 51ee6e5ceb xwayland: Check window pixmap in xwl_present_check_flip2
We can only flip if the window pixmap matches that of the toplevel
window. Doing so regardless could cause the toplevel window pixmap to
get destroyed while it was still referenced by the window, resulting in
use-after-free and likely a crash.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1033
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Roman Gilg <subdiff@gmail.com>
(cherry picked from commit 4c25356d6c)
2020-09-30 15:06:30 +00:00
Michel Dänzer 1e84fda202 xfree86: Take second reference for SavedCursor in xf86CursorSetCursor
The same pointer is kept in CurrentCursor as well, therefore two
RefCursor calls are needed.

Fixes use-after-free after switching VTs.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1067
(cherry picked from commit 919f1f46fc)
2020-09-30 15:06:30 +00:00
Olivier Fourdan af4c84ce88 Revert "linux: Make platform device probe less fragile"
This reverts commit 74b7427c41.

https://gitlab.freedesktop.org/xorg/xserver/-/issues/1068
2020-09-08 10:50:38 +02:00
Adam Jackson 74b7427c41 linux: Make platform device probe less fragile
At the point where xf86BusProbe runs we haven't yet taken our own VT,
which means we can't perform drm "master" operations on the device. This
is tragic, because we need master to fish the bus id string out of the
kernel, which we can only do after drmSetInterfaceVersion, which for
some reason stores that string on the device not the file handle and
thus needs master access.

Fortunately we know the format of the busid string, and it happens to
almost be the same as the ID_PATH variable from udev. Use that instead
and stop calling drmSetInterfaceVersion.

(backported from commit 0816e8fca6)

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
2020-08-18 17:20:09 +00:00