summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2018-02-13xfree86: Add ModulePath support for OutputClass config SectionsHans De Goede5-0/+56
Allow OutputClass config snippets to modify the module-path. Note that any specified ModulePaths will be pre-pended to the normal ModulePath. The idea behind this is that any output hardware specific modules should have preference over the normal modules. One use-case for this is the nvidia binary driver, this allows a config snippet like this: Section "OutputClass" MatchDriver "nvidia" Modulepath "/usr/lib64/nvidia/modules" EndSection To get the nvidia glx specific glx module loaded, but only when the nvidia kernel driver is loaded. Together with the glvnd work done recently, this allows the nouveau + mesa and nvidia-binary userspace stacks to co-exist on the same system without any ldconfig / xorg.conf tweaking and the xserver will automatically do the right thing depending on which kernel driver (nouveau or nvidia) is loaded. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit b5dffbbac193aa640ffcfa0a431c21b862854e53)
2018-02-13xfree86: Allow overriding primary GPU detection from an OutputClass sectionHans De Goede2-1/+30
Allow using: Option "PrimaryGPU" "yes" In an OutputClass section to override the default primary GPU device selection which selects the GPU used as output by the firmware. If multiple output devices match an OutputClass section with the PrimaryGPU option set, the first one enumerated becomes the primary GPU. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit d75ffcdbf8c1e3c8e0d46debcd533a9f2560f0a8)
2018-02-13xfree86: xf86platformProbe: split finding pci-info and setting primary GPUHans De Goede1-8/+15
This is a preparation patch for allowing an OutputClass section to override the default primary GPU device selection. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit ab1a65b7755d081b41188104b21f4d21eaa3187b)
2018-02-13xfree86: Add options support for OutputClass OptionsHans De Goede6-1/+65
Add support for setting options in OutputClass Sections and having these applied to any matching output devices. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit 9cd3cc75269d9196898487b5712ee47b8291e077)
2018-02-13xfree86: Make OutputClassMatches take a xf86_platform_deviceHans De Goede1-3/+4
Make OutputClassMatches directly take a xf86_platform_device as argument, rather then an index into xf86_platform_devices. This makes things easier for callers which already have a xf86_platform_device pointer. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit 08b84d72878e43401e99059c3c926dfa42a360c3)
2018-02-13xfree86: Free devlist returned by xf86MatchDeviceHans De Goede1-0/+4
xf86MatchDevice returns a dynamically allocated list of GDevPtr-s, free this when we're done with it. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit c57c1e53ea3d76ebba5b2a23b7260817d3e6b921)
2018-02-13xfree86: Try harder to find atleast 1 non GPU ScreenHans de Goede5-3/+33
If we did not find any non GPU Screens, try again ignoring the notion of any video devices being the primary device. This fixes Xorg exiting with a "no screens found" error when using virtio-vga in a virtual-machine and when using a device driven by simpledrm. This is a somewhat ugly solution, but it is the best I can come up with without major surgery to the bus and probe code. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit 75c4f6e412e07c5d416fa9ad8d7defd972d2baa9)
2018-02-13xfree86: Make adding unclaimed devices as GPU devices a separate stepHans de Goede3-0/+25
This is primarily a preparation patch for fixing the xserver exiting with a "no screens found" error even though there are supported video cards, due to the server not recognizing any card as the primary card. This also fixes the (mostly theoretical) case of a platformBus capable driver adding a device as GPUscreen before a driver which only supports the old PCI probe method gets a chance to claim it as a normal screen. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit 7121b03d324fccf687d49b63c53da7c8d93038c9)
2018-02-13xfree86: Remove redundant ServerIsNotSeat0 check from xf86CallDriverProbeHans de Goede1-2/+0
If foundScreen is TRUE, then all the code below the removed if will not execute until we reach the return foundScreen; at the end, so this entire if block is redundant. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit b72d161cad15bec9dd082d30521c5383be526c56)
2018-02-12xwayland: Don't process cursor warping without an xwl_seatLyude Paul1-0/+7
Unfortunately, on my machine Xwayland immediately crashes when I try to start it. gdb backtrace: #0 0x00007ffff74f0e79 in wl_proxy_marshal () from target:/lib64/libwayland-client.so.0 #1 0x0000000000413172 in zwp_confined_pointer_v1_destroy (zwp_confined_pointer_v1=0x700000000) at hw/xwayland/Xwayland@exe/pointer-constraints-unstable-v1-client-protocol.h:612 #2 0x0000000000418bc0 in xwl_seat_destroy_confined_pointer (xwl_seat=0x8ba2a0) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2839 #3 0x0000000000418c09 in xwl_seat_unconfine_pointer (xwl_seat=0x8ba2a0) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2849 #4 0x0000000000410d97 in xwl_cursor_confined_to (device=0xa5a000, screen=0x8b9d80, window=0x9bdb70) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland.c:328 #5 0x00000000004a8571 in ConfineCursorToWindow (pDev=0xa5a000, pWin=0x9bdb70, generateEvents=1, confineToScreen=0) at /home/lyudess/Projects/xserver/dix/events.c:900 #6 0x00000000004a94b7 in ScreenRestructured (pScreen=0x8b9d80) at /home/lyudess/Projects/xserver/dix/events.c:1387 #7 0x0000000000502386 in RRScreenSizeNotify (pScreen=0x8b9d80) at /home/lyudess/Projects/xserver/randr/rrscreen.c:160 #8 0x000000000041a83c in update_screen_size (xwl_output=0x8e7670, width=3840, height=2160) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:203 #9 0x000000000041a9f0 in apply_output_change (xwl_output=0x8e7670) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:252 #10 0x000000000041aaeb in xdg_output_handle_done (data=0x8e7670, xdg_output=0x8e7580) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:307 #11 0x00007ffff50e9d1e in ffi_call_unix64 () at ../src/x86/unix64.S:76 #12 0x00007ffff50e968f in ffi_call (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>) at ../src/x86/ffi64.c:525 #13 0x00007ffff74f3d8b in wl_closure_invoke () from target:/lib64/libwayland-client.so.0 #14 0x00007ffff74f0928 in dispatch_event.isra () from target:/lib64/libwayland-client.so.0 #15 0x00007ffff74f1be4 in wl_display_dispatch_queue_pending () from target:/lib64/libwayland-client.so.0 #16 0x00007ffff74f200b in wl_display_roundtrip_queue () from target:/lib64/libwayland-client.so.0 #17 0x0000000000418cad in InitInput (argc=12, argv=0x7fffffffd9c8) at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2867 #18 0x00000000004a20e3 in dix_main (argc=12, argv=0x7fffffffd9c8, envp=0x7fffffffda30) at /home/lyudess/Projects/xserver/dix/main.c:250 #19 0x0000000000420cb2 in main (argc=12, argv=0x7fffffffd9c8, envp=0x7fffffffda30) at /home/lyudess/Projects/xserver/dix/stubmain.c:34 This appears to be the result of xwl_cursor_confined_to() and xwl_screen_get_default_seat(). While not against protocol, mutter ends up sending xdg_output before wl_seat. xwl_screen_get_default_seat() makes the naïve assumption that we always have a valid seat, we end up returning a pointer to the empty list itself instead of an actual seat and causing ourselves to segfault. So, actually return NULL in xwl_screen_get_default_seat() if the seat list is empty, and skip any pointer confinement processing in xwl_cursor_confined_to() when we don't have a seat setup yet. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 98edb9a35e2cdd61355656b82975d7f2b6a9f0e6)
2018-02-12xwayland: remove dirty window unconditionally on unrealizeOlivier Fourdan1-2/+1
This is a rare occurrence of a crash in Xwayland for which I don't have the reproducing steps, just a core file. The backtrace looks as follow: #0 raise () from /usr/lib64/libc.so.6 #1 abort () from /usr/lib64/libc.so.6 #2 OsAbort () at utils.c:1361 #3 AbortServer () at log.c:877 #4 FatalError () at log.c:1015 #5 OsSigHandler () at osinit.c:154 #6 <signal handler called> #7 xwl_glamor_pixmap_get_wl_buffer () at xwayland-glamor.c:162 #8 xwl_screen_post_damage () at xwayland.c:514 #9 block_handler () at xwayland.c:665 #10 BlockHandler () at dixutils.c:388 #11 WaitForSomething () at WaitFor.c:219 #12 Dispatch () at dispatch.c:422 #13 dix_main () at main.c:287 The crash is caused by dereferencing “xwl_pixmap->buffer” in xwl_glamor_pixmap_get_wl_buffer() because “xwl_pixmap” is NULL. Reason for this is because the corresponding pixmap is from the root window and xwayland is rootless by default. This can happen if the window was mapped, redirected, damaged and unredirected immediately, before the damage is processed by Xwayland. Make sure to remove the dirty window from the damage list on unrealize to prevent this from happening. Credit goes to Adam Jackson <ajax@nwnk.net> and Daniel Stone <daniel@fooishbar.org> for finding the root cause the issue. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 3362422e8413dd9f231cfac50ce0a0862525b1bf)
2018-02-12xf86XvMCScreenInit: Clear pScreenPriv->dixinfo when freeing pAdaptMichel Dänzer1-0/+1
Fixes double-free later in xf86XvMCCloseScreen, which would generally cause fireworks. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (cherry picked from commit 75408f53d4e203e462b2f13ea4b06264f0e59ad2)
2018-01-22xfree86: add default modes for 16:9 and 16:10Martin Wilck1-0/+141
Improve the user experience for users with wide screens by adding standard 16:9 and 16:10 modes to extramodes, as suggested previously (https://lists.x.org/archives/xorg-devel/2016-February/048866.html). Tested successfully on my laptop. Feedback welcome. See also https://bugs.freedesktop.org/show_bug.cgi?id=37858. Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit a5e9bcad7ad0887f804905b482894b85751519fb)
2018-01-22Xorg.wrap: Ensure correct ordering of post-install hookLukáš Krejčí1-2/+2
The install rule of Xorg.wrap is currently a dependency of the install-data target instead of the install-exec target. The build also uses install-exec-hook to change the ownership and set the SUID bit on the Xorg.wrap binary. The problem is that install-exec-hook is only ordered respective to the install-exec target, the rules of install-data may or may not have been executed. If install-exec-hook runs before the Xorg.wrap binary is in place, a message similar to the following will be present in the build log: chown: cannot access '/pkgdir/usr/lib/xorg-server/Xorg.wrap': No such file or directory make[6]: [Makefile:1151: install-exec-hook] Error 1 (ignored) All that needs to be done is to change the name of the program variable to contain 'exec' for the install rule to depend on the install-exec target. Excerpt from the Automake manual, chapter 12.2 The Two Parts of Install: "Any variable using a user-defined directory prefix with ‘exec’ in the name (e.g., myexecbin_PROGRAMS) is installed by install-exec. All other user-defined prefixes are installed by install-data." https://bugs.freedesktop.org/show_bug.cgi?id=104419 Signed-off-by: Lukáš Krejčí <lskrejci@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit f615cb62d47cb24ea31718e8226df53ce6651c91)
2018-01-22xwayland: avoid race condition on new keymapOlivier Fourdan1-1/+1
When the Wayland compositor notifies of a new keymap, for the first X11 client using the keyboard, the last slave keyboard used might still not be set (i.e. “lastSlave” is still NULL). As a result, the new keymap is not applied, and the first X11 window will have the wrong keymap set initially. Apply the new keymap to the master keyboard as long as there's one. Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=791383 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 170c95978530f6373bdf4488116902b273f3abf4)
2017-12-13xwayland: Fix non-argb cursor conversionOlivier Fourdan1-1/+1
From the bug: "What happens if bits->width is less than 8? :)" Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=103012 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 97ac59b1ed3624f7c04e54dd3e3dadfa46a8f170)
2017-12-13glx: Fix glXQueryContext for GLX_FBCONFIG_ID and GLX_RENDER_TYPE (v2)Adam Jackson1-1/+1
Just never filled in, oops. Seems to have gone unnoticed because normally glXQueryContext simply returns the values filled in by the client library when the context was created. The only path by which you normally get to a GLXQueryContext request is glXImportContext, and then only if the context is already indirect. However, that's a statement about Mesa's libGL (and anything else that inherited that bit of the SGI SI more or less intact). Nothing prevents a mischeivous client from issuing that request of a direct context, and if they did we'd be in trouble because we never bothered to preserve the associated fbconfig in the context state, so we'd crash looking up GLX_VISUAL_ID_EXT. So let's fix that too. v2: Fixed missing preservation of the config in DRI2 (Eric Anholt) Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 5d667df6ea1634191a26f9a7c26bc883701d62b0)
2017-12-13edid: fix off-by-one error in CEA mode numberingHector Martin1-2/+2
The CEA extension short video descriptors contain the VIC, which starts at 1, not 0. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hector Martin <marcan@marcan.st> (cherry picked from commit 68556d74b49e99d3490166c446079f7d5de26ca4)
2017-12-13modesetting: Fix potential buffer overflowDaniel Martin1-26/+14
If one misconfigures a ZaphodHeads value (more than 20 characters without a delimiter), we get an overflow of our buffer. Use xstrtokenize() instead of writing/fixing our own tokenizer. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (cherry picked from commit 04a305121fbc08ecc2ef345ee7155d6087a43fd1)
2017-12-13ramdac: Check ScreenPriv != NULL in xf86ScreenSetCursor()Alex Goins1-1/+8
Similar to change cba5a10f, xf86ScreenSetCursor() would dereference ScreenPriv without NULL checking it. If Option "SWCursor" is specified, ScreenPriv == NULL. Without this fix, it is observed that setting Option "SWCursor" "on" on the modesetting driver in a PRIME configuration will segfault the server. It is important to return success rather than failure in the instance that ScreenPriv == NULL and pCurs == NullCursor, because otherwise xf86SetCursor() can fall into infinite recursion: xf86SetCursor(pCurs) calls xf86ScreenSetCursor(pCurs), and if FALSE, calls xf86SetCursor(NullCursor). If xf86ScreenSetCursor(NullCursor) returns FALSE, it calls xf86SetCursor(NullCursor) again and this repeats forever. Signed-off-by: Alex Goins <agoins@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 68d95e759f8b6ebca6bd52e69e6bc34cc174f8ca)
2017-10-12hw/xfree86: unvalidated lengthsNathan Kidd2-35/+47
This addresses: CVE-2017-12180 in XFree86-VidModeExtension CVE-2017-12181 in XFree86-DGA CVE-2017-12182 in XFree86-DRI Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Nathan Kidd <nkidd@opentext.com> Signed-off-by: Julien Cristau <jcristau@debian.org> (cherry picked from commit 1b1d4c04695dced2463404174b50b3581dbd857b)
2017-10-12Unvalidated lengthsNathan Kidd1-0/+2
v2: Add overflow check and remove unnecessary check (Julien Cristau) This addresses: CVE-2017-12184 in XINERAMA CVE-2017-12185 in MIT-SCREEN-SAVER CVE-2017-12186 in X-Resource CVE-2017-12187 in RENDER Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Nathan Kidd <nkidd@opentext.com> Signed-off-by: Julien Cristau <jcristau@debian.org> (cherry picked from commit cad5a1050b7184d828aef9c1dd151c3ab649d37e)
2017-10-12Revert "xf86-video-modesetting: Add ms_queue_vblank helper [v3]"Adam Jackson5-95/+97
Apparently introduces a regression: https://bugs.freedesktop.org/103243 This reverts commit 388dc1aeac9acf2d51ad5103570beffd81d78b96.
2017-10-04xf86-video-modesetting: Add ms_queue_vblank helper [v3]Keith Packard5-97/+95
This provides an API wrapper around the kernel interface for queueing a vblank event, simplifying all of the callers. v2: Fix missing '|' in computing vbl.request.type v3: Remove spurious bit of next patch (thanks, Michel Dänzer) Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 677c32bcda98a96585bb1f66b57e0755a157b772)
2017-10-04dmx: Remove some not-very-interesting debug printsAdam Jackson1-63/+0
gcc/glibc think the snprintf in dmxExecOS() might truncate. Yes, it might, and we also don't care. Just delete all this. Signed-off-by: Adam Jackson <ajax@redhat.com> Acked-by: Keith Packard <keithp@keithp.com> (cherry picked from commit d6db66811643d3762716f6b144a7358572216a4f)
2017-10-04dmx: Silence an unused-result warningAdam Jackson1-1/+2
Modern glibc is very insistent that you care about whether write() succeeds: ../hw/dmx/input/usb-keyboard.c: In function ‘kbdUSBCtrl’: ../hw/dmx/input/usb-keyboard.c:292:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] write(priv->fd, &event, sizeof(event)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 17ad6e5d5616039021455bc821d6ee2497f7ebde)
2017-10-04Move statically linked xorgxkb files from dixmods to a separate directoryJon TURNEY7-8/+24
[ajax: Fixed test/Makefile.am as well] Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit fbdd73fac68383c93f6f5c6a7615860503039999)
2017-10-04modesetting: Blacklist EVDI devices from PRIME syncDawid Kurek1-0/+5
UDL (usb) devices are blacklisted because of they weird behaviour when it comes to vblank events. As EVDI uses very similar model of handling vblanks it should be treated similarly. When doing a page flip, EVDI does not wait for real vblank, but simulates it by adding constant delay. It also does not support DRM_IOCTL_WAIT_VBLANK. In contrast to UDL, EVDI uses platform devices, thus instead of 'usb' in path they all have 'platform'. It is possible to blacklist by 'platform', so without explicitly saying 'evdi', but it might be misleading when it comes to real reason for it. Signed-off-by: Dawid Kurek <dawid.kurek@displaylink.com> (cherry picked from commit fbd80b2c8ebe9fd41229dc5438524d107c071ff1)
2017-10-04modesetting: Skip no-longer-present connectors when resetting BAD linksKeith Packard1-1/+4
Outputs may have NULL mode_output (connector) pointers if the connector disappears while the server is running. Skip these when resetting outputs with BAD link status. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 37f4e7651a2fd51efa613a08a1e705553be33e76)
2017-10-04modesetting: re-set the crtc's mode when link-status goes BADMartin Peres1-0/+51
Despite all the careful planning of the kernel, a link may become insufficient to handle the currently-set mode. At this point, the kernel should mark this particular configuration as being broken and potentially prune the mode before setting the offending connector's link-status to BAD and send the userspace a hotplug event. This may happen right after a modeset or later on. Upon receiving a hot-plug event, we iterate through the connectors to re-apply the currently-set mode on all the connectors that have a link-status property set to BAD. The kernel may be able to get the link to work by dropping to using a lower link bpp (with the same display bpp). However, the modeset may fail if the kernel has pruned the mode, so to make users aware of this problem a warning is outputed in the logs to warn about having a potentially-black display. This patch does not modify the current behaviour of always propagating the events to the randr clients. This allows desktop environments to re-probe the connectors and select a new resolution based on the new (currated) mode list if a mode disapeared. This behaviour is expected in order to pass the Display Port compliance tests. Signed-off-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit bcee1b76aa0db8525b491485e90b8740763d7de6)
2017-09-25xfree86: up the path name size to 512 in xf86MatchDriverFromFilesPeter Hutterer1-1/+1
./hw/xfree86/common/xf86pciBus.c: In function ‘xf86MatchDriverFromFiles’: ../hw/xfree86/common/xf86pciBus.c:1330:52: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=] snprintf(path_name, sizeof(path_name), "%s/%s", ^~~~~~~ ../hw/xfree86/common/xf86pciBus.c:1330:13: note: ‘snprintf’ output between 2 dirent->d_name is 256, so sprintf("%s/%s") into a 256 buffer gives us: and 257 bytes into a destination of size 256 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 96af794dc648eadcd596893412d7530e92cb5421)
2017-09-25suid: Include sysmacros.h to fix build after glibc-2.25Nick Sarnie1-0/+3
[Added HAVE_SYS_SYSMACROS_H guard - ajax] Signed-off-by: Nick Sarnie <commendsarnex@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 84e3b96b531363e47f6789aacfcae4aa60135e2e)
2017-09-25xfree86: Silence a new glibc warningAdam Jackson2-0/+6
glibc would like to stop declaring major()/minor() macros in <sys/types.h> because that header gets included absolutely everywhere and unix device major/minor is perhaps usually not what's expected. Fair enough. If one includes <sys/sysmacros.h> as well then glibc knows we meant it and doesn't warn, so do that if it exists. Signed-off-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit d732c36597fab2e9bc4f2aa72cf1110997697557)
2017-09-25xwayland: Fix a segfault with pointer lockingOlivier Fourdan1-0/+3
Xwayland would crash in some circumstances while trying to issue a pointer locking when the cursor is hidden when there is no seat focus window set. The crash signature looks like: #0 zwp_pointer_constraints_v1_lock_pointer () #1 xwl_pointer_warp_emulator_lock () at xwayland-input.c:2584 #2 xwl_seat_maybe_lock_on_hidden_cursor () at xwayland-input.c:2756 #3 xwl_seat_maybe_lock_on_hidden_cursor () at xwayland-input.c:2765 #4 xwl_seat_cursor_visibility_changed () at xwayland-input.c:2768 #5 xwl_set_cursor () at xwayland-cursor.c:245 #6 miPointerUpdateSprite () at mipointer.c:468 #7 miPointerDisplayCursor () at mipointer.c:206 #8 CursorDisplayCursor () at cursor.c:150 #9 AnimCurDisplayCursor () at animcur.c:220 #10 ChangeToCursor () at events.c:936 #11 ActivatePointerGrab () at events.c:1542 #12 GrabDevice () at events.c:5120 #13 ProcGrabPointer () at events.c:4908 #14 Dispatch () at dispatch.c:478 #15 dix_main () at main.c:276 xwl_pointer_warp_emulator_lock() tries to use the surface from the xwl_seat->focus_window leading to a NULL pointer dereference when that value is NULL. Check that xwl_seat->focus_window is not NULL earlier in the stack in xwl_seat_maybe_lock_on_hidden_cursor() and return early if not the case to avoid the crash. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102474 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit cdd0352ba05d4d8482aaca41797e05d40e58da36)
2017-09-25dri2: Sync i965_pci_ids.h from Mesa.Rodrigo Vivi1-0/+23
Copied from Mesa with no modifications. Gives us Coffee Lake and Cannon Lake PCI IDs. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> (cherry picked from commit abb031e731f5c159add1b3351de9c4bb121bf00a)
2017-09-25wayland: Sync drm.xml with MesaAdam Jackson1-16/+19
... where it is named src/egl/wayland/wayland-drm/wayland-drm.xml and has its requests sorted by protocol version number, avoiding a warning from wayland-scanner. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 04511a0476b5c860e7d157b01080dff94d935f74)
2017-09-25xfree86/modes: Use RRTransformEqual in xf86RandR12CrtcSetMichel Dänzer1-2/+1
The memcmp didn't catch when e.g. only the filter changed. Tested by alternately running xrandr --output DVI-I-0 --scale-from 3840x2160 --filter bilinear xrandr --output DVI-I-0 --scale-from 3840x2160 --filter nearest Reviewed-by: Aaron Plattner <aplattner@nvidia.com> (cherry picked from commit 4212c884c423e5ce2cd3b4d67c0d656475fddc79)
2017-09-25modesetting: Validate the atom for enum propertiesAdam Jackson1-1/+2
The client could have said anything here, and if what they said doesn't actually name an atom NameForAtom() will return NULL, and strcmp() will be unhappy about that. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit d4995a3936ae283b9080fdaa0905daa669ebacfc)
2017-09-25xwayland: Lock the pointer if it is confined and has no cursorCarlos Garnacho1-1/+28
In the typical pattern in games of "hide cursor, grab with a confineTo, warp constantly the pointer to the middle of the window" the last warping step is actually rather optional. Some games may choose to just set up a grab with confineTo argument, and trust that they'll get correct relative X/Y axis values despite the hidden cursor hitting the confinement window edge. To cater for these cases, lock the pointer whenever there is a pointer confinement and the cursor is hidden. This ensures the pointer position is in sync with the compositor's when it's next shown again, and more importantly resorts to the relative pointer for event delivery. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit ca17f3e9fd3b59fdc5ffd0e5d78e4db6ddc87aa1)
2017-09-25xwayland: Update root window size when desktop size changesCarlos Garnacho2-1/+6
This fixes grabs on InputOnly windows whose parent is the root window failing with GrabNotViewable. This is due to window->borderSize/windowSize being computed as clipped by its parent, resulting in a null region. Setting up the right size on the root window makes the InputOnly size correct too, so the GrabNotViewable paths aren't hit anymore. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 513e3bd3870fdb8a8e0e2e52c0fa93872300bc8b)
2017-09-25xwayland: "Accept" confineTo on InputOnly windowsCarlos Garnacho1-0/+9
Of sorts, actually make it confine to the pointer focus, as the InputOnly window is entirely invisible to xwayland accounting, we don't have a xwl_window for it. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit fafdb0cc9697eb53635ed1e78bec1d4cd87ab3a2)
2017-09-25xwayland: Allow pointer warp on root/None windowCarlos Garnacho1-0/+20
Of sorts, as we can't honor pointer warping across the whole root window coordinates, peek the pointer focus in these cases. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit c217fcb4c4640ffd2fefee63c6fcd7ea5e64b942)
2017-09-25xwayland: Don't load extension list more than onceLyude1-2/+3
When running an Xwayland server from the command line, we end up resetting the server every time all of the clients connected to the server leave. This would be fine, except that xwayland makes the mistake of unconditionally calling LoadExtensionList(). This causes us to setup the glxExtension twice in a row which means that when we lose our last client on the second server generation, we end up trying to call the glx destructors twice in a row resulting in a segfault: (EE) (EE) Backtrace: (EE) 0: Xwayland (OsSigHandler+0x3b) [0x4982f9] (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x70845bf] (EE) 2: /usr/lib64/dri/swrast_dri.so (__driDriverGetExtensions_virtio_gpu+0x32897d) [0x1196e5bd] (EE) 3: /usr/lib64/dri/swrast_dri.so (__driDriverGetExtensions_virtio_gpu+0x328a45) [0x1196e745] (EE) 4: /usr/lib64/dri/swrast_dri.so (__driDriverGetExtensions_virtio_gpu+0x32665f) [0x11969f7f] (EE) 5: Xwayland (__glXDRIscreenDestroy+0x30) [0x54686e] (EE) 6: Xwayland (glxCloseScreen+0x3f) [0x5473db] (EE) 7: Xwayland (glxCloseScreen+0x53) [0x5473ef] (EE) 8: Xwayland (dix_main+0x7b6) [0x44c8c9] (EE) 9: Xwayland (main+0x28) [0x61c503] (EE) 10: /lib64/libc.so.6 (__libc_start_main+0xf1) [0x72b1401] (EE) 11: Xwayland (_start+0x2a) [0x4208fa] (EE) 12: ? (?+0x2a) [0x2a] (EE) (EE) Segmentation fault at address 0x18 (EE) Fatal server error: (EE) Caught signal 11 (Segmentation fault). Server aborting (EE) Easy reproduction recipe: - Start an Xwayland session with the default settings - Open a window - Close that window - Open another window - Close that window - Total annihilation occurs Signed-off-by: Lyude <lyude@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 4f29366f1e5678505fb882143c9b4a892d5b8273)
2017-09-25xfree86: Fix interpretation of xf86WaitForInput timeoutJason Gerecke1-0/+3
Commit aa6717ce2 switched xf86WaitForInput from using select(2) to using poll(2). Before this change, the timeout was interpreted as being in microseconds; afterwards it is fed directly to xorg_poll which interprets it as being in milliseconds. This results in the function potentially blocking 1000x longer than intended. This commit scales down the timeout argument before passing it to xorg_poll, being careful to ensure the result is not rounded down due to integer division. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 2fbf62b2fb3dcb29551251d09aa695715bb754f4)
2017-09-25os: Handle SIGABRTMichel Dänzer2-0/+2
Without this, assertion failures can make life hard for users and those trying to help them. v2: * Change commit log wording slightly to "can make life hard", since apparently e.g. logind can alleviate that somewhat. * Set default handler for SIGABRT in hw/xfree86/common/xf86Init.c:InstallSignalHandlers() and hw/xquartz/quartz.c:QuartzInitOutput() (Eric Anholt) Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (cherry picked from commit 27a6b9f7c84c914d0f5909ec1069d72f5035bc04)
2017-09-25xfree86/modes: Make colormap/gamma glue code work with RandR disabledMichel Dänzer1-45/+91
E.g. because Xinerama is enabled. Fixes crash on startup and wrong colours in that case. Bugzilla: https://bugs.freedesktop.org/100293 Bugzilla: https://bugs.freedesktop.org/100294 Fixes: 62f44052573b ("xfree86/modes: Move gamma initialization to xf86RandR12Init12 v2") Tested-by: Mariusz Bialonczyk <manio@skyboo.net> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 41dafcc2a2942fc4c94ce3cbafc4a1b413c460c3)
2017-09-22xephyr: Check for host XVideo support before trying to use itAdam Jackson1-0/+5
Otherwise xcb will treat our attempt to send xv requests as a connection error (quite reasonably: we're asking it to emit a request for which there is no defined major opcode), and we'll die quietly the first time we hit KdBlockhandler. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 14d2fe74f4e51c5b37eab4b7475c804a0340b530)
2017-09-22modesetting: Set correct DRM event context versionDaniel Stone1-1/+1
DRM_EVENT_CONTEXT_VERSION is the latest context version supported by whatever version of libdrm is present. modesetting was blindly asserting it supported whatever version that may be, even if it actually didn't. With libdrm 2.4.78, setting a higher context version than 2 will attempt to call the page_flip_handler2 vfunc if it was non-NULL, which being a random chunk of stack memory, it might well have been. Set the version as 2, which should be bumped only with the appropriate version checks. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 0c8e6ed85810e96d84173a52d628863802a78d82)
2017-09-22dmx: Fix null pointer dereferenceTobias Stoeckmann1-1/+1
A null pointer dereference can occur in dmxSync, because TimerForce does not handle a null pointer. dmxSyncTimer is set to NULL a few lines above on a certain condition, which happened on my machine. The explicit NULL check allowed me to start Xdmx again without a segmentation fault. Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 21eda7464d0e13ac6558edaf6531c3d3251e05df)
2017-09-22dri2: Sync i965_pci_ids.h from Mesa.Kenneth Graunke1-19/+21
Copied from Mesa with no modifications. Gives us Geminilake PCI IDs. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 368f60d461421fe5e2bbd90652d6ac858dbff8fe)