summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
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)
2017-09-22ephyr: Don't clobber bitsPerPixel when using glamorAdam Jackson1-1/+0
This ends up passing 0 as the bpp argument to fb screen setup, which is not really the best plan. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 83c4297d2c4fd501a9d36bc0cb7d357a8d22394c)
2017-09-21parser: Fix crash when xf86nameCompare(s1 = x, s2 = NULL)Adam Jackson1-0/+2
Signed-off-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit f1f865e909090406841a9b9416ea6259a75c2086)
2017-09-21Xephyr: Check screen resources creation successOlivier Fourdan2-2/+9
If the screen pixmap or the corresponding texture creation with glamor fails, exit cleanly with an error message instead of segfaulting. Fixes: https://bugzilla.redhat.com/1431633 Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> (cherry picked from commit b0ce1d088a863492f5de11e4dbde10af4261d892)
2017-03-13xwayland: Monitor client states to destroy callbacksOlivier Fourdan1-8/+52
In XWayland, dri3_send_open_reply() is called from a sync callback, so there is a possibility that the client might be gone when we get to the callback eventually, which leads to a crash in _XSERVTransSendFd() from WriteFdToClient() . Client resources can survive the client itself, in which case we may end up in our sync callback trying to access client's data after it's been freed/reclaimed. Add a ClientStateCallback handler to monitor the client state changes and clear the sync callback set up by the glamor drm code if any. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1416553 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100040 Tested-by: Mark B <mark.blakeney@bullet-systems.net> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (cherry picked from commit 937527f9798d573ec82c2c508821899c229c018f)
2017-03-13xwayland: clear cursor frame callbackOlivier Fourdan1-2/+12
After an X cursor is unrealized, the seat's corresponding x_cursor is cleared, but if a frame callback was pending at the time, it will remain and thus prevent any further cursor update, leaving the window with no cursor. Make sure to destroy the frame callback, if any, when that occurs, so that next time a cursor needs to be set, it won't be ignored for a frame callback that will never be triggered. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1389327 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Rui Matos <tiagomatos@gmail.com> (cherry picked from commit d4b7e0eaa4b2e97ce1dec653a2ae7d9621fe1431)
2017-03-02xwayland: do not set checkRepeat on master kbdOlivier Fourdan1-5/+0
keyboard_check_repeat() fetches the XWayland seat from the dev->public.devicePrivate do do its thing. If a key event is sent programmatically through Xtest, our device is the virtual core keyboard and that has a dev->public.devicePrivate of NULL, leading to a segfault in keyboard_check_repeat(). This is the case with "antimicro" which sends key events based on the joystick buttons. Don't set the checkRepeat handler on the VCK since it cannot possibly work anyway and it has no effect on the actual checkRepeat intended functionality. Bugzilla: https://bugzilla.redhat.com/1416244 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 fe5c340046c8cf755b92763a49b2dc475e856a76)
2017-03-02xwayland: Make sure we have a focus windowOlivier Fourdan1-0/+6
During the InitInput() phase, the wayland events get dequeued so we can possibly end up calling dispatch_pointer_motion_event(). If this occurs before xwl_seat->focus_window is set, it leads to a NULL pointer derefence and a segfault. Check for xwl_seat->focus_window in both pointer_handle_frame() and relative_pointer_handle_relative_motion() prior to calling dispatch_pointer_motion_event() like it's done in pointer_handle_motion(). Bugzilla: https://bugzilla.redhat.com/1410804 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 8c9909a99292b2fb4a86de694bb0029f61e35662)
2017-02-23xwayland: Add hack for FWXGA resolution #99574Svitozar Cherepii1-0/+7
For some applications (like fullscreen games) it matters for XRandr resolution to be correctly set and equal to root window resolution. In XServer there is already hack for this, adapted it for XWayland. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99574 Signed-off-by: Svitozar Cherepii <razotivs@gmail.com> Tested-by: Svitozar Cherepii <razotivs@gmail.com> Acked-by: Olivier Fourdan <ofourdan@redhat.com> (cherry picked from commit 1c78bec9ca3cd1975a38bf5ebdba7dea65b309ab)
2017-02-23xwayland: CRTC should support all rotationsOlivier Fourdan1-1/+8
If the Wayland compositor sets a rotation on the output, Xwayland translates the transformation as an xrandr rotation for the given output. However, if the rotation is not supported by the CRTC, this is not a valid setup and xrandr queries will fail. Pretend we support all rotations and reflections so that the configuration remains a valid xrandr setup. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99663 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit afeace27d3818274b75d59375771dc964d2f56bb)
2017-02-23xwayland: Apply output rotation for screen sizeOlivier Fourdan1-12/+16
Previously, we would swap the width/height of the Xwayland output based on the output rotation, so that the overall screen size would match the actual rotation of each output. Problem is the RandR's ConstrainCursorHarder() handler will also apply the output rotation, meaning that when the output is rotated, the pointer will be constrained within the wrong dimension. Moreover, XRandR assumes the original output width/height are unchanged when the output is rotated, so by changing the Xwayland output width and height based on rotation, Xwayland causes XRandr to report the wrong output sizes (an output of size 1024x768 rotated left or right should remain 1024x768, not 768x1024). So to avoid this issue and keep things consistent between Wayland and Xwayland outputs, leave the actual width/height unchanged but apply the rotation when computing the screen size. This fixes both the output size being wrong in "xrandr -q" and the pointer being constrained in the wrong dimension with rotated with weston. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99663 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 058809c43ec578a407cf40d4c3e54a42503e3562)
2017-02-17xfree86: Take input_lock() for xf86ScreenCheckHWCursorChris Wilson1-7/+20
(cherry picked from commit 3eb964e25243056dd998f52d3b00171b71c89189)
2017-02-17xfree86: Take input lock for xf86TransparentCursorChris Wilson1-0/+4
(cherry picked from commit cfddd919cce4178baba07959e5e862d02e166522)
2017-02-17xfree86: Take the input lock for xf86RecolorCursorChris Wilson1-6/+18
xf86RecolorCursor() may be called directly from XRecolorCursor as well as from xf86ScreenSetCursor(). In the latter case, the input lock is already held, but not for the former and so we need to add a wrapper function that acquires the input lock before performing xf86RecolorCursor() References: https://bugs.freedesktop.org/show_bug.cgi?id=99358 (cherry picked from commit 7198a6d4e74f684cb383b3e0f70dd2bae405e6e7)
2017-01-11xfree86: fix wrong usage of xf86optionListMergeQiang Yu1-1/+1
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 1012510620de7dadd0ab18b19a8e11facd884601)
2017-01-11edid: Add quirk for ADA 1024x600 7" display.Kai-Heng Feng1-0/+5
Detailed mode reports 108 mm x 68 mm which is for smaller display. Maximum image size reports 15 cm x 10 cm which aligns with its physical size, use this size instead. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 9874f73e88678c9eacbcba05e52336fc63a32712)
2017-01-11Fix a segfault that occurs if xorg.conf.d is absent:Ben Crocker3-1/+25
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE (which it does if no config file or directory is present), the autoconfig flag is set, causing xf86AutoConfig to be called later on. xf86AutoConfig calls xf86OutputClassDriverList via the call tree: xf86AutoConfig => listPossibleVideoDrivers => xf86PlatformMatchDriver => xf86OutputClassDriverList and xf86OutputClassDriverList attempts to traverse a linked list that is a member of the XF86ConfigRec struct pointed to by the global xf86configptr, which is NULL at this point because the XF86ConfigRec struct is only allocated (by xf86readConfigFile) AFTER the config file and directory have been successfully opened; the CONFIG_NOFILE return from xf86HandleConfigFile occurs BEFORE the call to xf86readConfigFile which allocates the XF86ConfigRec struct. Rx: In read.c (for symmetry with xf86freeConfig, which already appears in this file), add a new function xf86allocateConfig which tests the value of xf86configptr and, if it's NULL, allocates the XF86ConfigRec struct and deposits the pointer in xf86configptr. In xf86Parser.h, add a prototype for the new xf86allocateConfig function. Back in read.c, #include "xf86Config.h". In xf86readConfigFile, change the open-code call to calloc to a call to the new xf86allocateConfig function. In xf86AutoConfig.c, add a call to the new xf86allocateConfig function to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct is allocated. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Ben Crocker <bcrocker@redhat.com> (cherry picked from commit 8b335d9068fe4e1f1423a4d86c22b69ffcb819a5)
2017-01-11xwayland: Fix use after free of cursorsOlivier Fourdan1-4/+13
Sometimes, Xwayland will try to use a cursor that has just been freed, leading to a crash when trying to access that cursor data either in miPointerUpdateSprite() or AnimCurTimerNotify(). CheckMotion() updates the pointer's cursor based on which xwindow XYToWindow() returns, and Xwayland implements its own xwl_xy_to_window() to fake a crossing to the root window when the pointer has left the Wayland surface but is still within the xwindow. But after an xwindow is unrealized, the last xwindow used to match the xwindows is cleared so two consecutive calls to xwl_xy_to_window() may not return the same xwindow. To avoid this issue, update the last_xwindow based on enter and leave notifications instead of xwl_xy_to_window(), and check if the xwindow found by the regular miXYToWindow() is a child of the known last xwindow, so that multiple consecutive calls to xwl_xy_to_window() return the same xwindow, being either the one found by miXYToWindow() or the root window. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1385258 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Tested-by: Vít Ondruch <vondruch@redhat.com> Tested-by: Satish Balay <balay@fastmail.fm> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> (cherry picked from commit 59ad0e6a416d8e23f9d962af67a16ee28ec7867b)
2017-01-11xwayland: Don't send KeyRelease events on wl_keyboard::leaveRui Matos1-6/+2
Commits 816015648ffe660ddaa0f7d4d192e555b723c372 and fee0827a9a695600765f3d04376fc9babe497401 made it so that wl_keyboard::enter doesn't result in X clients getting KeyPress events while still updating our internal xkb state to be in sync with the host compositor. wl_keyboard::leave needs to be handled in the same way as its semantics from an X client POV should be the same as an X grab getting triggered, i.e. X clients shouldn't get KeyRelease events for keys that are still down at that point. This patch uses LeaveNotify for these events on wl_keyboard::leave and changes the current use of KeymapNotify to EnterNotify instead just to keep some symmetry between both cases. On ProcessDeviceEvent() we still need to deactivate X grabs if needed for KeyReleases. Signed-off-by: Rui Matos <tiagomatos@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 5611585b87ce48428a66f98ece319a083f55d205)
2016-11-02dri2: Sync i965_pci_ids.h from mesaTimo Aaltonen1-15/+17
Import changes from these mesa commits: 85ea8deb26da420 i965: Removing PCI IDs that are no longer listed as Kabylake. bdff2e554735ed9 i956: Add more Kabylake PCI IDs. f1fa8b4a1ca73fa i965/bxt: Add 2x6 variant d1ab544bb883d04 i965/chv: Display proper branding 20e8ee36627f874 i965/skl: Update Skylake renderer strings 644c8a515192d28 i965/skl: Add two missing device IDs Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Timo Aaltonen <tjaalton@ubuntu.com>
2016-11-01xwayland-shm: block signals during fallocateIan Ray1-0/+10
posix_fallocate() does an explicit rollback if it gets EINTR, and this is a problem on slow systems because when the allocation size is sufficiently large posix_fallocate() will always be interrupted by the smart scheduler's SIGALRM. Changes since v1 - big comment in the code to explain what is going on Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Ian Ray <ian.ray@ge.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Acked-by: Daniel Stone <daniels@collabora.com>
2016-10-28Merge remote-tracking branch 'jturney/master'Keith Packard1-0/+2
2016-10-28ephyr: Leave window unmapped for -glamor-skip-present [v2]Keith Packard1-1/+5
If we're never painting anything in the window, we probably don't need to map it. v2: Drop ephyr_glamor_gles2 from hostx.c Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-10-28ramdac: Check sPriv != NULL in xf86CheckHWCursor()Alex Goins1-0/+4
xf86CheckHWCursor() would dereference sPriv without NULL checking it. If Option "SWCursor" is specified, sPriv == NULL. In this case we should assume that HW cursors are not supported. Signed-off-by: Alex Goins <agoins@nvidia.com> Reviewed-by: Andy Ritger <aritger@nvidia.com> Signed-off-by: Keith Packard <keithp@keithp.com>