aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-06-08render: Add wlr_renderer_blit_dmabuf()Andri Yngvason
2020-06-08render: egl: Add utility functions for saving/restoring contextAndri Yngvason
2020-06-08backend/drm: fix stack overflow in dealloc_crtcSimon Ser
Call drm_crtc_commit directly instead of calling drm_connector_set_mode. This restores the previous behaviour where conn_enable was called [1]. [1]: https://github.com/swaywm/wlroots/blob/0c7c562482575cacaecadcd7913ef25aeb21711f/backend/drm/drm.c#L1093 Closes: https://github.com/swaywm/wlroots/issues/2253
2020-06-08contributing: add note about events that destroy objectsSimon Ser
2020-06-08contributing: resource destroy handlers need to cleanup pointersSimon Ser
2020-06-06render: choose DMA-BUF texture target via eglQueryDmaBufModifiersEXTSimon Ser
EGL_EXT_image_dma_buf_import_modifiers tells us whether we should use GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES. Using the right texture target can fix some failures and/or improve performance on some drivers. This does the same as a Weston commit [1]. [1]: https://gitlab.freedesktop.org/wayland/weston/commit/40c519a3e613 Closes: https://github.com/swaywm/wlroots/issues/2173
2020-06-06util/time: move `timespec_sub` to time utilitiesTudor Brindus
2020-06-06util/time: de-duplicate `timespec_to_msec`Tudor Brindus
2020-06-06util: fix and move `get_current_time_msec` into a util fileTudor Brindus
This commit makes `get_current_time_msec` correctly return milliseconds as opposed to microseconds. It also considers the value of `tv_sec`, so we don't lose occasionally go back in time by one second. Finally, the function is moved into `util/time.cc` so that it can be reused elsewhere without having to consider these pitfalls.
2020-06-05Allow keyboard and pointer grabs to hook clear_focus()Thomas Hebb
This is necessary for some grabs, which currently have no way of knowing when the pointer/keyboard focus has left a surface. For example, without this, a drag-and-drop grab can erroneously drop into a window that the cursor is no longer over. This is the plumbing needed to properly fix swaywm/sway#5220. The existing fix, swaywm/sway#5222, relies on every grab's `enter()` hook allowing a `NULL` surface. This is not guaranteed by the API and, in fact, is not the case for the xdg-shell popup grab and results in a crash when the cursor leaves a surface and does not immediately enter another one while a popup is open (#2161). This fix also adds an assertion to wlr_seat_pointer_notify_enter() that ensures it's never called with a `NULL` surface. This will make Sway crash much more until it fixes its usage of the API, so we should land this at the same time as a fix in Sway (which I haven't posted yet).
2020-06-05wlr_seat: Clarify wording of non-grab-respecting function commentsThomas Hebb
I found the previous wording a bit confusing when I first read it. Reword these comments to explicitly say that the grab-respecting variants should be used in most cases. This change has no functional effect.
2020-06-05wlr_seat: Declare functions in the same order for pointer, keyboard, and touchThomas Hebb
These three APIs are very similar to one another, but they all had slightly different function orderings. For consistency, always declare the non_`notify` functions first, then the `notify` functions, then `{start,end,has}_grab`. This change has no functional effect.
2020-06-03backend/drm: fix black screens when enabling outputSimon Ser
This patch fixes this failure: 01:57:16.642 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending 01:57:16.684 [ERROR] [backend/drm/drm.c:360] Failed to page-flip output 'eDP-1': a page-flip is already pending 01:57:16.684 [ERROR] [backend/drm/drm.c:732] Failed to initialize renderer on connector 'eDP-1': initial page-flip failed 01:57:16.684 [ERROR] [backend/drm/drm.c:805] Failed to initialize renderer for plane 01:57:16.684 [sway/config/output.c:423] Failed to commit output eDP-1 References: https://github.com/swaywm/sway/issues/5101
2020-06-02render: stop making EGL context current in wlr_egl_initSimon Ser
This leaves an EGL context current behind. wlr_gles2_renderer_create was assuming the EGL context was already current because of this (because it called a GL function right off the bat).
2020-06-02backend/wayland: fix spurious eglSwapBuffers failuresSimon Ser
This was introduced in [1]. However after reverting that PR I still can't reproduce the bug the PR aimed to fix [2]. Since there's no good explanation why we would need to swap buffers before resizing, let's just revert the PR. [1]: https://github.com/swaywm/wlroots/pull/1486 [2]: https://github.com/swaywm/wlroots/issues/1371 Closes: https://github.com/swaywm/wlroots/issues/1768
2020-06-01backend/wayland: scale tablet tool position into [0, 1] rangeTudor Brindus
Fixes #2233.
2020-06-01backend/drm: always perform a CRTC commit in drm_connector_commitSimon Ser
When the mode, status or buffer hasn't changed, drm_connector_commit was a no-op. Because of this individual changes to the gamma LUT or adaptive sync status were ignored (if committed without a buffer). Instead, perform a commit to apply the changes.
2020-06-01backend/drm: drop extra wlr_output_update_enabled callSimon Ser
drm_connector_set_mode already takes care of keeping this up-to-date.
2020-06-01backend/drm: commit/rollback FBs in drm_crtc_commitSimon Ser
We need to perform the FB bookkeeping on all commits, not just on page-flips.
2020-06-01backend/drm: make adaptive_sync atomicSimon Ser
Stop using drmModeObjectSetProperty, set the property in the crtc_commit function instead.
2020-06-01backend/drm: rollback pending CRTC state on test commitSimon Ser
A test commit doesn't apply the pending state. The CRTC state will be populated again if the compositor decides to perform a regular commit afterwards.
2020-06-01export-dmabuf: Keep frame->output = NULL until frame is readyAndri Yngvason
This fixes a crash that happens when a client requests a frame on a backend that does not implement export_dmabuf. An assertion fails with the message: sway: types/wlr_output.c:777: wlr_output_lock_attach_render: Assertion `output->attach_render_locks > 0' failed.
2020-05-31wlr_keyboard_group: introduce enter and leaveBrian Ashworth
This introduces the enter and leave events for wlr_keyboard_group. The enter event is emitted when a keyboard is added to the group while a key is pressed that is not pressed by any other keyboard in the group. The data is a wl_array of the pressed key codes unique to the keyboard that should now be considered pressed. Similarly the leave event is emitted when a keyboard is removed from the group while at least one key is pressed that is not pressed by any other keyboard in the group. The data is a wl_array of the pressed key codes unique to the keyboard that should now be considered released. The purpose of these events are to allow the compositor to update its state to avoid corruption. Additionally, for the leave event, the focused surface may have been notified of a key press for some or all of the key codes and needs to be notified of a key release to avoid state corruption. These were previously emitted as normal key events, but they are not normal key events. There is no actual key press or release associated with the events. It's purely for state keeping purposes. Emitting them as separate events allows the compositor to handle them differently. Since these are purely for state keeping purposes and are not associated with an actual key being pressed or released, bindings should not be triggered as a result of these events.
2020-05-29Don't send redundant capability updatesKalyan Sriram
2020-05-28Add comments for missing tablet tool entriesSimon Ser
And stop using default cases, so that we know which parts of the code need an update when adding a new enum entry. Closes: https://github.com/swaywm/wlroots/issues/2208
2020-05-28seat: Create inert objects for missing capabilitiesKenny Levinsen
We should throw a protocol error if the relevant capability has never existed when get_(pointer|keyboard|touch) is called. Otherwise, it should succeed, even if the capability is not currently present. This follows the spec, and avoids possible races with the client when capabilities are lost. Closes: https://github.com/swaywm/wlroots/issues/2227
2020-05-27backend/drm: fix missing crtc->cursor NULL checkSimon Ser
Fixes: cdb6fdbc6cb7 ("backend/drm: remove missing cursor plane workaround")
2020-05-27backend/drm: don't set cursor if off-screenSimon Ser
Closes: https://github.com/swaywm/wlroots/issues/2216
2020-05-27xwayland: add error-checking to `server_start_lazy`Tudor Brindus
This prevents a very unlikely crash in `xwayland_socket_connected`. Refs #2163.
2020-05-26backend/drm: introduce pending and current CRTC stateSimon Ser
Previously, we only had the pending state (crtc->pending, crtc->mode and crtc->active). This causes issues when a commit fails: the pending state is left as-is, and the next commit may read stale data from it. This will also cause issues when implementing test-only commits: we need to rollback the pending CRTC state after a test-only commit. Introduce separate pending and current CRTC states. Properly update the current state after a commit.
2020-05-26backend/drm: nuke retry_pageflipSimon Ser
retry_pageflip is now dead code, since drm_connector_start_renderer isn't called anymore. It was previously called when enabling an output. The name "retry_pageflip" was a little confusing because the function retried a modeset and the timer wasn't set up while performing a simple page-flip. Let's just remove this altogether for now. We can discuss whether it's worth it to bring it back. Should we only do it on failed page-flips? Should we only do it on EBUSY?
2020-05-26backend/drm: make drm_connector_set_mode take a wlr_drm_connectorSimon Ser
Since this is an internal DRM backend function, there's no reason we need to take a generic wlr_output.
2020-05-26backend/drm: remove enable_drm_connectorSimon Ser
Merge enable_drm_connector into drm_connector_set_mode. This allows us to de-duplicate logic since enabling an output performs a modeset.
2020-05-26backend/drm: remove drm_connector_set_custom_modeSimon Ser
Replace it with a function that returns the pending mode.
2020-05-26backend/drm: refuse to enable an output without a modeSimon Ser
2020-05-26backend/drm: rollback atomic blobsSimon Ser
If the atomic commit fails or is test-only, rollback wlr_drm_crtc.{mode_id,gamma_lut} blob IDs to their previous value. This prevents the next commits from failing or applying test-only state.
2020-05-25xwayland: send focus change event unconditionallyTudor Brindus
This fixes issues with (at least) dialogs in Jetbrains IDEs becoming unclickable if they ever lost focus (ref. swaywm/sway#5373). Prior to this change, since `xwm->focus_surface` would be set prior to `xwm_surface_activate` being called, the latter would short-circuit immediately and not notify the application of the focus change.
2020-05-24util/log: use bright black rather than black for WLR_DEBUGTudor Brindus
On some terminals under default settings, black is truly rendered as `#000`, making it unreadable when the background is also black. Refs swaywm/sway#5141.
2020-05-20render/egl: unset current context after swapping buffersSimon Ser
After swapping buffers, it doesn't make sense to perform more rendering operations. Unset the context to reflect this. This commit makes it so the context is always only current between wlr_egl_make_current and wlr_egl_swap_buffers. This is an alternative to [1]. [1]: https://github.com/swaywm/wlroots/pull/2212
2020-05-20examples: make output-power-management oneshot by defaultIlia Bozhinov
2020-05-19xwayland: add option to disable WMSimon Ser
2020-05-19xwayland: split serverSimon Ser
Split the server part of wlr_xwayland into wlr_xwayland_server. This allows compositors to implement their own XWM when wlroots' isn't a good fit.
2020-05-19backend/drm: add missing wlr_egl_unset_currentSimon Ser
2020-05-19backend/drm: fix current EGL context on multi-GPUSimon Ser
get_tex_for_bo changes the current EGL context. Rendering operations must immediately follow drm_surface_make_current. Closes: https://github.com/swaywm/wlroots/issues/2209
2020-05-19render/egl: introduce wlr_egl_unset_currentSimon Ser
This function can be called after wlr_egl_make_current to cleanup the EGL context. This avoids having lingering EGL contexts that make things work by chance. Closes: https://github.com/swaywm/wlroots/issues/2197
2020-05-19Fix -Wreturn-type warningsSimon Ser
When calling assert(0) instead of returning a value, -Wreturn-type warnings are triggered because assertions can be disabled. Replace these assertions with abort().
2020-05-18Make wlr_xcursor_manager_load() return a boolIsaac Freund
This is currently inconsistent with the rest of the library and a bit of a footgun for new compositors. However, this breaks the API in a very unfortunate way for existing compositors.
2020-05-14backend/drm: fix atomic commits when the GAMMA_LUT prop is missingSimon Ser
We already have the logic to fallback to the legacy interface above. We just need to avoid calling atomic_add with a zero prop ID. Closes: https://github.com/swaywm/wlroots/issues/2187
2020-05-14output: make wlr_output_set_gamma atomicSimon Ser
wlr_output_set_gamma is now double-buffered and applies the gamma LUT on the next output commit.
2020-05-14tablet: expose wlr_tablet_tool_v2_has_implicit_grab functionTudor Brindus
This is necessary so that sway can determine when to start emulating pointer events -- it shouldn't start doing so during an implicit grab, even if the pen is over a surface that doesn't bind tablet input. Refs swaywm/sway#5302.