Re: [PATCH] os: Server terminated successfully is not an error
Keith Packard kei...@keithp.com writes: Aaron Plattner aplatt...@nvidia.com writes: ErrorFSigSafe calls LogVMessageVerbSigSafe with the message type set to X_ERROR. That generates this in the log: (EE) Server terminated successfully (0). Closing log file. People periodically report this as an error, sometimes quoting this error rather than an earlier error that actually caused a problem. Signed-off-by: Aaron Plattner aplatt...@nvidia.com --- Is X_NOTICE too weird to use? X_INFO would work too. There are only two instances of X_NOTICE in the server today, both seem to indicate an unusual situation which the server has recovered from. I'd suggest that this should probably be X_INFO instead, which is what all of the regular startup messages use. Otherwise, this looks like a fix that might keep people from mis-interpreting this message. With X_NOTICE - X_INFO: Reviewed-by: Keith Packard kei...@keithp.com With X_INFO, Reviewed-by: Eric Anholt e...@anholt.net pgp5eco4yj70a.pgp Description: PGP signature ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] os: Fix timer race conditions
On Fri, Nov 14, 2014 at 23:52:55 +0530, Nikhil Mahale wrote: From 40f5100cb73aad8f90ba2c926dd08c4e15789de0 Mon Sep 17 00:00:00 2001 From: Nikhil Mahale nmah...@nvidia.com Date: Tue, 11 Nov 2014 17:44:28 +0530 Subject: [PATCH] os: Fix timer race conditions Fixing following kind of race-conditions - WaitForSomething() | // timers - timer-1 - timer-2 - null while (timers (int) (timers-expires - now) = 0) // prototype - DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) DoTimer(timers, now, timers) | | OsBlockSignals(); OS Signal comes just before blocking it, timer-1 handler gets called. // timer-1 gets served and scheduled again; // timers - timer-2 - timer-1 - null *prev = timer-next; timer-next = NULL; // timers - null // timers list gets corrupted here and timer-2 gets removed from list. https://bugs.freedesktop.org/show_bug.cgi?id=86288 Signed-off-by: Nikhil Mahale nmah...@nvidia.com --- os/WaitFor.c | 31 +-- 1 file changed, 21 insertions(+), 10 deletions(-) As far as I can tell after this change DoTimer is always called with signals disabled, so it doesn't need to disable them itself? Cheers, Julien ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 0/3] XWayland: Support focus key array correctly
Hi, This one has a pretty long and tortured history, beginning with: https://bugzilla.gnome.org/show_bug.cgi?id=727178 and culminating in: http://lists.freedesktop.org/archives/wayland-devel/2014-November/018268.html and the related thread. The tl;dr for those of you not wishing to read an 80-page thread, is that we correctly send wl_keyboard::enter events (Wayland's equivalent of FocusIn + KeymapNotify) to clients with the full list of depressed keys when we give them the keyboard focus. Unfortunately, XWayland quite naïvely just posts them through as full key presses, meaning that if you have Super+S as a screenshot binding, the compositor will return the focus with S held down, XWayland will send a KeyPress for S, and you'll then get a stray letter in your terminal, or whatever. There's no good support in the server for handling keys still down on enter, and it's not really a wonder why. In xkbcommon, we separated the state machinery out from key presses somewhat, so it's pretty trivial. But with in-server XKB, we don't really have a choice but to run the full XKB machinery. This patch series attempts to tame the damage somewhat by adding a new ET_KeyFocusIn internal event, which is plumbed from KeymapNotify in QueueKeyboardEvents co. This does everything but send KeyPress events to clients, and also suppresses some of the stronger XKB actions, e.g. if you have Ctrl+Alt+Backspace down as you _enter_, you won't then immediately terminate your server. XWayland is then trivially modified to send the keys through this on focus, instead of sending KeyPresses. Xephyr could definitely benefit from the same, but that is not a job for 10:35pm on a Friday night. Ultimately, it would be nice to have a similar mechanism to xkbcommon where we can inherit the resultant state (i.e. 'this set of modifiers is currently down') from the parent server, and not have to run the XKB state machinery at all, but I couldn't easily see how to make that work in the face of things like modifierKeyCount. This should be safe enough to apply to a stable series as well; it does, strictly speaking, add an internal event type, but it is to the end of the list, and I can't see it changing any other ABI. The only case would be if external modules blithely sent KeymapNotify to servers which were unaware, but, eh. (Maybe a minor input ABI bump?) The XKB behaviour definitely isn't perfect, but it's also objectively an improvement over previous, so. Cheers, Daniel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/3] Input: Add KeyFocusIn internal event
KeyFocusIn is used to notify the server that it has entered focus with a key held down, so should be used to update the internal state (including modifiers), but perform any actions such as sending key events to the client, switching VTs, etc. This is intended to be used for FocusIn/KeymapNotify when running nested servers such as Xephyr, as well as a wl_keyboard::enter event from XWayland. Running the currently-pressed keys through the entire XKB event mechanism is quite fragile, and will produce incorrect results in some cases, e.g. entering with Shift+AltGr pressed when Shift→AltGr will produce different results to AltGr→Shift. In this case, we need to lift the _actual_ modifier state from the parent server, however this is a much larger job. Signed-off-by: Daniel Stone dani...@collabora.com Tested-by: Giulio Camuffo giuliocamu...@gmail.com --- Xi/exevents.c | 8 +++- dix/events.c | 5 +++-- dix/getevents.c| 7 ++- dix/inpututils.c | 3 ++- include/eventstr.h | 1 + xkb/xkbActions.c | 38 ++ xkb/xkbPrKeyEv.c | 8 +--- 7 files changed, 58 insertions(+), 12 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index b0bc47e..cd2924a 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -810,6 +810,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event) case ET_ButtonPress: case ET_ButtonRelease: case ET_KeyPress: +case ET_KeyFocusIn: case ET_KeyRelease: case ET_ProximityIn: case ET_ProximityOut: @@ -854,7 +855,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event) v-axisVal[i] = event-valuators.data[i]; } -if (event-type == ET_KeyPress) { +if (event-type == ET_KeyPress || event-type == ET_KeyFocusIn) { if (!k) return DONT_PROCESS; @@ -1715,6 +1716,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) case ET_ButtonPress: case ET_ButtonRelease: case ET_KeyPress: +case ET_KeyFocusIn: case ET_KeyRelease: case ET_ProximityIn: case ET_ProximityOut: @@ -1749,6 +1751,10 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) if (!grab CheckDeviceGrabs(device, event, 0)) return; break; +case ET_KeyFocusIn: + /* FocusIn events are just for internal state management, and do not +* get posted to clients. */ + return; case ET_KeyRelease: if (grab device-deviceGrab.fromPassiveGrab (key == device-deviceGrab.activatingKey) diff --git a/dix/events.c b/dix/events.c index b8c67fd..49f21d1 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4308,10 +4308,11 @@ FixKeyState(DeviceEvent *event, DeviceIntPtr keybd) if (event-type == ET_KeyPress) { DebugF(FixKeyState: Key %d %s\n, key, - ((event-type == ET_KeyPress) ? down : up)); + ((event-type == ET_KeyPress) ? down : + ((event-type == ET_KeyFocusIn) ? down (focus) : up))); } -if (event-type == ET_KeyPress) +if (event-type == ET_KeyPress || event-type == ET_KeyFocusIn) set_key_down(keybd, key, KEY_PROCESSED); else if (event-type == ET_KeyRelease) set_key_up(keybd, key, KEY_PROCESSED); diff --git a/dix/getevents.c b/dix/getevents.c index dd96265..c2248fb 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1120,7 +1120,8 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type, UpdateFromMaster(events, pDev, DEVCHANGE_KEYBOARD_EVENT, num_events); /* Handle core repeating, via press/release/press/release. */ -if (type == KeyPress key_is_down(pDev, key_code, KEY_POSTED)) { +if ((type == KeyPress || type == KeymapNotify) +key_is_down(pDev, key_code, KEY_POSTED)) { /* If autorepeating is disabled either globally or just for that key, * or we have a modifier, don't generate a repeat event. */ if (!pDev-kbdfeed-ctrl.autoRepeat || @@ -1152,6 +1153,10 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type, event-type = ET_KeyPress; set_key_down(pDev, key_code, KEY_POSTED); } +else if (type == KeymapNotify) { + event-type = ET_KeyFocusIn; + set_key_down(pDev, key_code, KEY_POSTED); +} else if (type == KeyRelease) { event-type = ET_KeyRelease; set_key_up(pDev, key_code, KEY_POSTED); diff --git a/dix/inpututils.c b/dix/inpututils.c index e5bcc31..f6d781a 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -694,7 +694,8 @@ event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event) XkbStatePtr state; /* we need the state before the event happens */ -if (event-type == ET_KeyPress || event-type == ET_KeyRelease) +if (event-type == ET_KeyPress || event-type == ET_KeyRelease || + event-type == ET_KeyFocusIn) state = kbd-key-xkbInfo-prev_state;
[PATCH 3/3] XWayland: Use FocusIn events for keyboard enter
wl_keyboard::enter is the equivalent of FocusIn + KeymapNotify: it notifies us that the surface/window has now received the focus, and provides us a set of keys which are currently down. We should use these keys to update the current state, but not to send any events to clients. Signed-off-by: Daniel Stone dani...@collabora.com Tested-by: Giulio Camuffo giuliocamu...@gmail.com --- hw/xwayland/xwayland-input.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index b8c543c..c6a9c43 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -397,7 +397,7 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, wl_array_copy(xwl_seat-keys, keys); valuator_mask_zero(mask); wl_array_for_each(k, xwl_seat-keys) -QueueKeyboardEvents(xwl_seat-keyboard, KeyPress, *k + 8, mask); +QueueKeyboardEvents(xwl_seat-keyboard, KeymapNotify, *k + 8, mask); } static void @@ -410,6 +410,11 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, xwl_seat-xwl_screen-serial = serial; +/* Unlike keyboard_handle_enter() above, this time we _do_ want to trigger + * full release, as we don't know how long we'll be out of focus for. + * Notify clients that the keys have been released, disable autorepeat, + * etc. */ + valuator_mask_zero(mask); wl_array_for_each(k, xwl_seat-keys) QueueKeyboardEvents(xwl_seat-keyboard, KeyRelease, *k + 8, mask); -- 2.1.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 1/3] XKB: Split filter execution into a separate function
Move the giant state machine which maps from a key action to actually running the filters into a separate function, to be used when adding KeyFocusIn. Signed-off-by: Daniel Stone dani...@collabora.com Tested-by: Giulio Camuffo giuliocamu...@gmail.com --- xkb/xkbActions.c | 144 +-- 1 file changed, 76 insertions(+), 68 deletions(-) diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index c44f44b..c6cbf56 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -1192,6 +1192,80 @@ XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key) } } +static void +XkbActionGetFilter(DeviceIntPtr dev, DeviceEvent *event, KeyCode key, + XkbAction *act, int *sendEvent) +{ +XkbSrvInfoPtr xkbi = dev-key-xkbInfo; +XkbFilterPtr filter; + +switch (act-type) { +case XkbSA_SetMods: +case XkbSA_SetGroup: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterSetState(xkbi, filter, key, act); +break; +case XkbSA_LatchMods: +case XkbSA_LatchGroup: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterLatchState(xkbi, filter, key, act); +break; +case XkbSA_LockMods: +case XkbSA_LockGroup: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterLockState(xkbi, filter, key, act); +break; +case XkbSA_ISOLock: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterISOLock(xkbi, filter, key, act); +break; +case XkbSA_MovePtr: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterPointerMove(xkbi, filter, key, act); +break; +case XkbSA_PtrBtn: +case XkbSA_LockPtrBtn: +case XkbSA_SetPtrDflt: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterPointerBtn(xkbi, filter, key, act); +break; +case XkbSA_Terminate: +*sendEvent = XkbDDXTerminateServer(dev, key, act); +break; +case XkbSA_SwitchScreen: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterSwitchScreen(xkbi, filter, key, act); +break; +case XkbSA_SetControls: +case XkbSA_LockControls: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterControls(xkbi, filter, key, act); +break; +case XkbSA_ActionMessage: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterActionMessage(xkbi, filter, key, act); +break; +case XkbSA_RedirectKey: +filter = _XkbNextFreeFilter(xkbi); +/* redirect actions must create a new DeviceEvent. The + * source device id for this event cannot be obtained from + * xkbi, so we pass it here explicitly. The field deviceid + * equals to xkbi-device-id. */ +filter-priv = event-sourceid; +*sendEvent = _XkbFilterRedirectKey(xkbi, filter, key, act); +break; +case XkbSA_DeviceBtn: +case XkbSA_LockDeviceBtn: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterDeviceBtn(xkbi, filter, key, act); +break; +case XkbSA_XFree86Private: +filter = _XkbNextFreeFilter(xkbi); +*sendEvent = _XkbFilterXF86Private(xkbi, filter, key, act); +break; +} +} + void XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) { @@ -1201,7 +1275,6 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) int sendEvent; Bool genStateNotify; XkbAction act; -XkbFilterPtr filter; Bool keyEvent; Bool pressEvent; ProcessInputProc backupproc; @@ -1229,74 +1302,9 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) act = XkbGetButtonAction(kbd, dev, key); key |= BTN_ACT_FLAG; } + sendEvent = _XkbApplyFilters(xkbi, key, act); -if (sendEvent) { -switch (act.type) { -case XkbSA_SetMods: -case XkbSA_SetGroup: -filter = _XkbNextFreeFilter(xkbi); -sendEvent = _XkbFilterSetState(xkbi, filter, key, act); -break; -case XkbSA_LatchMods: -case XkbSA_LatchGroup: -filter = _XkbNextFreeFilter(xkbi); -sendEvent = _XkbFilterLatchState(xkbi, filter, key, act); -break; -case XkbSA_LockMods: -case XkbSA_LockGroup: -filter = _XkbNextFreeFilter(xkbi); -sendEvent = _XkbFilterLockState(xkbi, filter, key, act); -break; -case XkbSA_ISOLock: -filter = _XkbNextFreeFilter(xkbi); -sendEvent = _XkbFilterISOLock(xkbi, filter, key, act); -break; -case XkbSA_MovePtr: -filter = _XkbNextFreeFilter(xkbi); -sendEvent = _XkbFilterPointerMove(xkbi, filter, key, act); -break; -
Re: [PULL] couple of warning fixes
Peter Hutterer peter.hutte...@who-t.net writes: John Hunter (1): fix an annotation mistake Peter Hutterer (10): include: fix compiler warning about casting int to uint16_t include: fix documentation for list.h include: change RegionSize() to take a size_t Xext: fix clang compiler warning xfree86: drop double-typedef of DBusConnection xwayland: declare fatal log handler as noreturn dix: silence compiler warning dix: silence compiler warning comparing CARD32 to -1 Drop trailing whitespaces mi: fix documentation for miPointerSetPosition Merged. 65cc098..ec0ac89 master - master -- keith.pack...@intel.com signature.asc Description: PGP signature ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 3/3] XWayland: Use FocusIn events for keyboard enter
Daniel Stone dani...@collabora.com writes: wl_keyboard::enter is the equivalent of FocusIn + KeymapNotify: it notifies us that the surface/window has now received the focus, and provides us a set of keys which are currently down. Why don't you just filter out non-modifier keys and skip those? That should provide the basic functionality you want (persistent caps-lock, or even shift) without requiring a pile of other changes? -- keith.pack...@intel.com signature.asc Description: PGP signature ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 3/3] XWayland: Use FocusIn events for keyboard enter
Hi, On 25 Nov 2014, at 12:34 am, Keith Packard kei...@keithp.com wrote: Daniel Stone dani...@collabora.com writes: wl_keyboard::enter is the equivalent of FocusIn + KeymapNotify: it notifies us that the surface/window has now received the focus, and provides us a set of keys which are currently down. Why don't you just filter out non-modifier keys and skip those? That should provide the basic functionality you want (persistent caps-lock, or even shift) without requiring a pile of other changes? Because that's still a bunch of work, and even then doesn't necessarily get us correct results. It also fixes apps which do trust that the KeymapNotify isn't a pack of lies, which isn't an unreasonable demand to make. This patch isn't the end of the road; in the end, it should be entirely possible to achieve perfect nesting wrt KeymapNotify events with XWayland, Xephyr, XQuartz, and any combination thereof. This is a relatively start in that direction. Plus, it helps X catch up to Wayland's start of the art, which you should be all for, no? ;) Cheers, Daniel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
DRI3/Present fixes for XServers 1.16 and 1.17rc
Hi, i finally figured out why dri3/present failed so miserably with my neuro-science application, which relies on OML_sync_control and INTEL_swap_events extensively and worked nicely under dri2 for years. I found so far two bugs in the x-server and 3 bugs in mesas dri/present backend. I'll send out the mesa patches with fixes separately. The following two patches fix the x-server part for me. First one only caused pain during debugging - a bug in the DebugPresent macros, causing server crash on logout, closing of unredirected fullscreen windows, or toggling composition on/off whenever the debug macros were compiled in. The second patch fixes nouveau's massive tearing and various OML_sync_control related failures caused by lack of vsynced pageflips. The problem doesn't happen on intel, at least with the tested ddx versions, because intel-ddx (as of 2.99.914) never reports AsyncFlipCapability on my Intel HD Ironlake and Intel HD 4000 IvyBridge, so possibly a bug in the intel driver which cancels out with the server bug? These patches were tested to apply cleanly on master and on top of the 1.16.2 branch. They were tested on Intel HD, Intel HD-4000 and with nouveau on a NVidia gpu on top of 1.16.2. Could these be applied to 1.16 and later? thanks, -mario ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 1/2] present: Avoid crashes in DebugPresent(), a bit more info.
DebugPresent() crashed the server when a dri3 drawable was closed while a pageflipped present was still pending, due to vblank-window- Null-Ptr deref, so debug builds caused new problems to debug. E.g., glXSwapBuffers(...); glXDestroyWindow(...); - Pageflip for non-existent window completes - boom. Also often happens when switching desktop compositor on/off due to Present unflips, or when logging out of session. Also add info if a Present is queued for copyswap or pageflip, if the present is vsynced, and the serial no of the Present request, to aid debugging of pageflip and vsync issues. The serial number is useful as Mesa's dri3/present backend encodes its sendSBC in the serial number, so one can easily correlate server debug output with Mesa and with the SBC values returned to actual OpenGL client applications via OML_sync_control and INTEL_swap_events extension, makes debugging quite a bit more easy. Please also cherry-pick this for a 1.16.x stable update. Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com --- present/present.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/present/present.c b/present/present.c index cf283f4..d84bdef 100644 --- a/present/present.c +++ b/present/present.c @@ -435,7 +435,7 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) DebugPresent((\tn %lld %p %8lld: %08lx - %08lx\n, vblank-event_id, vblank, vblank-target_msc, vblank-pixmap ? vblank-pixmap-drawable.id : 0, - vblank-window-drawable.id)); + vblank-window ? vblank-window-drawable.id : 0)); assert (vblank == screen_priv-flip_pending); @@ -851,10 +851,10 @@ present_pixmap(WindowPtr window, } if (pixmap) -DebugPresent((q %lld %p %8lld: %08lx - %08lx (crtc %p)\n, +DebugPresent((q %lld %p %8lld: %08lx - %08lx (crtc %p) flip %d vsync %d serial %d\n, vblank-event_id, vblank, target_msc, vblank-pixmap-drawable.id, vblank-window-drawable.id, - target_crtc)); + target_crtc, vblank-flip, vblank-sync_flip, vblank-serial)); xorg_list_add(vblank-event_queue, present_exec_queue); vblank-queued = TRUE; @@ -946,7 +946,7 @@ present_vblank_destroy(present_vblank_ptr vblank) DebugPresent((\td %lld %p %8lld: %08lx - %08lx\n, vblank-event_id, vblank, vblank-target_msc, vblank-pixmap ? vblank-pixmap-drawable.id : 0, - vblank-window-drawable.id)); + vblank-window ? vblank-window-drawable.id : 0)); /* Drop pixmap reference */ if (vblank-pixmap) -- 2.1.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/2] present: Fix use of vsynced pageflips and honor PresentOptionAsync.
Pageflips for Pixmap presents were not synchronized to vblank by default, as they should be, due to some missing init for vblank-sync_flips. The PresentOptionAsync flag was completely ignored for controlling this. Vsynced flips only worked by accident on the intel-ddx, as that driver doesn't report PresentCapabilityAsync support (tested on Intel HD Ironlake and Intel HD 4000 IvyBridge + Linux 3.17). This lack might be a bug in the intel-ddx itself? On nouveau-ddx, which properly reports PresentCapabilityAsync, this always caused non-vsynced pageflips and pretty ugly tearing. This patch fixes the problem, as tested on top of XOrg 1.16.2 on nouveau and intel. Please also apply to XOrg 1.16 stable. Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com --- present/present.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/present/present.c b/present/present.c index d84bdef..f24a218 100644 --- a/present/present.c +++ b/present/present.c @@ -737,6 +737,10 @@ present_pixmap(WindowPtr window, */ window_priv-msc = crtc_msc; +/* Clear async request if driver can't support it for pixmap present */ +if (pixmap (!screen_priv-info || !(screen_priv-info-capabilities PresentCapabilityAsync))) +options = ~PresentOptionAsync; + /* Adjust target_msc to match modulus */ if (crtc_msc = target_msc) { @@ -828,9 +832,10 @@ present_pixmap(WindowPtr window, vblank-msc_offset = window_priv-msc_offset; vblank-notifies = notifies; vblank-num_notifies = num_notifies; +vblank-sync_flip = TRUE; -if (!screen_priv-info || !(screen_priv-info-capabilities PresentCapabilityAsync)) -vblank-sync_flip = TRUE; +if (options PresentOptionAsync) +vblank-sync_flip = FALSE; if (pixmap present_check_flip (target_crtc, window, pixmap, vblank-sync_flip, valid, x_off, y_off)) { vblank-flip = TRUE; -- 2.1.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 3/3] glx/dri3: Request non-vsynced Present for swapinterval zero.
Restores proper immediate tearing swap behaviour for OpenGL bufferswap under DRI3/Present. Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com --- src/glx/dri3_glx.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 5796491..c53be1b 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1518,6 +1518,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, xcb_connection_t *c = XGetXCBConnection(dpy); struct dri3_buffer *back; int64_t ret = 0; + uint32_t options = XCB_PRESENT_OPTION_NONE; unsigned flags = __DRI2_FLUSH_DRAWABLE; if (flush) @@ -1557,6 +1558,9 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, if (target_msc == 0) target_msc = priv-msc + priv-swap_interval * (priv-send_sbc - priv-recv_sbc); + if (priv-swap_interval == 0) + options |= XCB_PRESENT_OPTION_ASYNC; + back-busy = 1; back-last_swap = priv-send_sbc; xcb_present_pixmap(c, @@ -1570,7 +1574,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, None, /* target_crtc */ None, back-sync_fence, - XCB_PRESENT_OPTION_NONE, + options, target_msc, divisor, remainder, 0, NULL); -- 1.9.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/2] rrxinerama: report tiled monitors in one rectangle
From: Fedora X Ninjas x...@fedoraproject.org This changes the xinerama reporting for tiled monitors so that the large rectangle is reported as a single xinerama rectangle. Signed-off-by: Dave Airlie airl...@redhat.com --- randr/rrxinerama.c | 122 +++-- 1 file changed, 118 insertions(+), 4 deletions(-) diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 26894a6..4a71678 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -153,18 +153,61 @@ RRXineramaCrtcActive(RRCrtcPtr crtc) return crtc-mode != NULL crtc-numOutputs 0; } +static Atom GetTileAtom(void) +{ +return MakeAtom(TILE, sizeof(TILE) - 1, TRUE); +} + +struct tile_info { +int id; +int flags; +int h_tiles; +int v_tiles; +int h_loc; +int v_loc; +int h_tile_size; +int v_tile_size; +}; + +static int SplitTile(RRPropertyValuePtr tile_val, + struct tile_info *info) +{ +const char *tok = tile_val-data; + +return sscanf(tok, %d:%d:%d:%d:%d:%d:%d:%d, + info-id, info-flags, + info-h_tiles, info-v_tiles, + info-h_loc, info-v_loc, + info-h_tile_size, info-v_tile_size); +} + static int RRXineramaScreenCount(ScreenPtr pScreen) { -int i, n; +int i, n, o; ScreenPtr slave; - +RRPropertyPtr tile; +struct tile_info info; n = 0; if (rrGetScrPriv(pScreen)) { rrScrPriv(pScreen); for (i = 0; i pScrPriv-numCrtcs; i++) if (RRXineramaCrtcActive(pScrPriv-crtcs[i])) n++; + +/* remove tiles */ +for (i = 0; i pScrPriv-numCrtcs; i++) { +for (o = 0; o pScrPriv-crtcs[i]-numOutputs; o++) { +RROutputPtr output = pScrPriv-crtcs[i]-outputs[o]; +tile = RRQueryOutputProperty(output, GetTileAtom()); +if (!tile) +continue; + +SplitTile(tile-current, info); +if (info.h_loc || info.v_loc) +n--; +} +} } xorg_list_for_each_entry(slave, pScreen-output_slave_list, output_head) { @@ -312,13 +355,74 @@ RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc) } } +static void +RRXineramaWriteTile(ClientPtr client, ScreenPtr pScreen, RRPropertyPtr orig) +{ +rrScrPriv(pScreen); +RRPropertyPtr tile; +xXineramaScreenInfo scratch; +int o; +int total_w = 0, total_h = 0; +int orig_id; +int width, height; +int x_org = 0, y_org = 0; +struct tile_info info; +int ret; + +ret = SplitTile(orig-current, info); +if (ret 0) +return; + +if (info.h_loc 0 || info.v_loc 0) +return; + +orig_id = info.id; +for (o = 0; o pScrPriv-numOutputs; o++) { +RROutputPtr output = pScrPriv-outputs[o]; + +if (!output-crtc) +continue; +tile = RRQueryOutputProperty(output, GetTileAtom()); + +if (!tile) +continue; + +ret = SplitTile(tile-current, info); +if (orig_id == info.id) { +RRCrtcGetScanoutSize(output-crtc, width, height); +if (info.h_loc == 0 info.v_loc == 0) { +x_org = output-crtc-x; +y_org = output-crtc-y; +} +if (info.h_loc == 0) +total_h += height; +if (info.v_loc == 0) +total_w += width; +} +} + +scratch.x_org = x_org; +scratch.y_org = y_org; +scratch.width = total_w; +scratch.height = total_h; + +if (client-swapped) { +swaps(scratch.x_org); +swaps(scratch.y_org); +swaps(scratch.width); +swaps(scratch.height); +} +WriteToClient(client, sz_XineramaScreenInfo, scratch); +} + int ProcRRXineramaQueryScreens(ClientPtr client) { xXineramaQueryScreensReply rep; ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; int n = 0; -int i; +int i, o; +RRPropertyPtr tile; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); @@ -351,12 +455,22 @@ ProcRRXineramaQueryScreens(ClientPtr client) } for (i = 0; i pScrPriv-numCrtcs; i++) { +Bool skip = FALSE; if (has_primary pScrPriv-primaryOutput-crtc == pScrPriv-crtcs[i]) { has_primary = 0; continue; } -RRXineramaWriteCrtc(client, pScrPriv-crtcs[i]); +for (o = 0; o pScrPriv-crtcs[i]-numOutputs; o++) { +RROutputPtr output = pScrPriv-crtcs[i]-outputs[o]; +tile = RRQueryOutputProperty(output, GetTileAtom()); +if (tile) { +RRXineramaWriteTile(client, pScreen, tile); +skip = TRUE; +} +} +if (!skip) +RRXineramaWriteCrtc(client, pScrPriv-crtcs[i]); } xorg_list_for_each_entry(slave,
[PATCH 1/2] xf86Crtc: add tile prop setting
From: Fedora X Ninjas x...@fedoraproject.org Add support for drivers to set the tiling property. This is used by clients to work out the monitor tiles for DisplayID monitors. Signed-off-by: Dave Airlie airl...@redhat.com --- hw/xfree86/modes/xf86Crtc.c | 30 ++ hw/xfree86/modes/xf86Crtc.h | 13 +++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 9d592a7..ddf4e7d 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -3026,6 +3026,25 @@ xf86OutputSetEDIDProperty(xf86OutputPtr output, void *data, int data_len) } } +#define TILE_ATOM_NAME TILE +static void +xf86OutputSetTileProperty(xf86OutputPtr output, const char *data, int data_len) +{ +Atom tile_atom = MakeAtom(TILE_ATOM_NAME, sizeof(TILE_ATOM_NAME) - 1, TRUE); + +/* This may get called before the RandR resources have been created */ +if (output-randr_output == NULL) +return; + +if (data_len != 0) { +RRChangeOutputProperty(output-randr_output, tile_atom, XA_INTEGER, 8, + PropModeReplace, data_len, (char *)data, FALSE, TRUE); +} +else { +RRDeleteOutputProperty(output-randr_output, tile_atom); +} +} + #endif /* Pull out a phyiscal size from a detailed timing if available. */ @@ -3071,6 +3090,17 @@ handle_detailed_physical_size(struct detailed_monitor_section } } +void +xf86OutputSetTile(xf86OutputPtr output, const char *tile_data, int tile_length) +{ +output-tile_info = tile_data; +output-tile_length = tile_length; +#ifdef RANDR_12_INTERFACE +xf86OutputSetTileProperty(output, tile_data ? tile_data : NULL, + tile_length); +#endif +} + /** * Set the EDID information for the specified output */ diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 692bf40..49101cb 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -226,7 +226,7 @@ typedef struct _xf86CrtcFuncs { } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; -#define XF86_CRTC_VERSION 5 +#define XF86_CRTC_VERSION 6 struct _xf86Crtc { /** @@ -500,7 +500,7 @@ typedef struct _xf86OutputFuncs { (*destroy) (xf86OutputPtr output); } xf86OutputFuncsRec, *xf86OutputFuncsPtr; -#define XF86_OUTPUT_VERSION 2 +#define XF86_OUTPUT_VERSION 3 struct _xf86Output { /** @@ -615,6 +615,9 @@ struct _xf86Output { BoxRec initialTotalArea; BoxRec initialTrackingArea; INT16 initialBorder[4]; + +const char *tile_info; +int tile_length; }; typedef struct _xf86ProviderFuncs { @@ -881,6 +884,12 @@ extern _X_EXPORT void xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon); /** + * Set the TILE information for the specified output + */ +extern _X_EXPORT void +xf86OutputSetTile(xf86OutputPtr output, const char *tile_data, int tile_length); + +/** * Return the list of modes supported by the EDID information * stored in 'output' */ -- 2.1.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/3] glx/dri3: Track separate (ust, msc) for PresentPixmap vs. PresentNotifyMsc
Prevent calls to glXGetSyncValuesOML() and glXWaitForMscOML() from overwriting the (ust,msc) values of the last successfull swapbuffers call (PresentPixmapCompleteNotify event), as glXWaitForSbcOML() relies on those values corresponding to the most recent completed swap, not to whatever was last returned from the server. Problematic call sequence without this patch would have been, e.g., glXSwapBuffers() ... wait ... swap completes - PresentPixmapComplete event - (ust,msc) updated to reflect swap completion time and count. ... wait for at least 1 video refresh cycle/vblank increment. glXGetSyncValuesOML() - PresentNotifyMsc event overwrites (ust,msc) of swap completion with (ust,msc) of most recent vblank glXWaitForSbcOML() - Returns sbc of last completed swap but (ust,msc) of last completed vblank, not of last completed swap. - Client is confused. Do this by tracking a separate set of (ust, msc) for the dri3_wait_for_msc() call than for the dri3_wait_for_sbc() call. This makes the glXWaitForSbcOML() call robust again and restores consistent behaviour with the DRI2 implementation. Fixes applications originally written and tested against DRI2 which also rely on this not regressing under DRI3/Present, e.g., Neuro-Science software like Psychtoolbox-3. This patch fixes the problem. Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com --- src/glx/dri3_glx.c | 11 +++ src/glx/dri3_priv.h | 5 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index b4ac278..5796491 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -420,11 +420,14 @@ dri3_handle_present_event(struct dri3_drawable *priv, xcb_present_generic_event_ if (psc-show_fps_interval) show_fps(priv, ce-ust); + + priv-ust = ce-ust; + priv-msc = ce-msc; } else { priv-recv_msc_serial = ce-serial; + priv-vblank_ust = ce-ust; + priv-vblank_msc = ce-msc; } - priv-ust = ce-ust; - priv-msc = ce-msc; break; } case XCB_PRESENT_EVENT_IDLE_NOTIFY: { @@ -498,8 +501,8 @@ dri3_wait_for_msc(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, } } - *ust = priv-ust; - *msc = priv-msc; + *ust = priv-vblank_ust; + *msc = priv-vblank_msc; *sbc = priv-recv_sbc; return 1; diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h index 8e46640..222deb0 100644 --- a/src/glx/dri3_priv.h +++ b/src/glx/dri3_priv.h @@ -182,9 +182,12 @@ struct dri3_drawable { uint64_t send_sbc; uint64_t recv_sbc; - /* Last received UST/MSC values */ + /* Last received UST/MSC values for pixmap present complete */ uint64_t ust, msc; + /* Last received UST/MSC values for vblank */ + uint64_t vblank_ust, vblank_msc; + /* Serial numbers for tracking wait_for_msc events */ uint32_t send_msc_serial; uint32_t recv_msc_serial; -- 1.9.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] mi: Fix regression in arc drawing
Aaron Plattner aplatt...@nvidia.com writes: Signed-off-by: Adam Jackson a...@redhat.com Reviewed-by: Aaron Plattner aplatt...@nvidia.com Tested and merged. ec0ac89..c52a2b1 master - master (Would you believe I hit this in an actual application?) -- keith.pack...@intel.com signature.asc Description: PGP signature ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [Mesa-dev] [PATCH 3/3] glx/dri3: Request non-vsynced Present for swapinterval zero.
Hi, This patch removes the tripple buffering behaviour that the GLX implementation has with DRI3. I understand your concern for Medical softwares, but perhaps this would be better handled with an user option. Axel Davy On 25/11/2014 04:00, Mario Kleiner wrote : Restores proper immediate tearing swap behaviour for OpenGL bufferswap under DRI3/Present. Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com --- src/glx/dri3_glx.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 5796491..c53be1b 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1518,6 +1518,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, xcb_connection_t *c = XGetXCBConnection(dpy); struct dri3_buffer *back; int64_t ret = 0; + uint32_t options = XCB_PRESENT_OPTION_NONE; unsigned flags = __DRI2_FLUSH_DRAWABLE; if (flush) @@ -1557,6 +1558,9 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, if (target_msc == 0) target_msc = priv-msc + priv-swap_interval * (priv-send_sbc - priv-recv_sbc); + if (priv-swap_interval == 0) + options |= XCB_PRESENT_OPTION_ASYNC; + back-busy = 1; back-last_swap = priv-send_sbc; xcb_present_pixmap(c, @@ -1570,7 +1574,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, None, /* target_crtc */ None, back-sync_fence, - XCB_PRESENT_OPTION_NONE, + options, target_msc, divisor, remainder, 0, NULL); ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel