aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2021-08-25backend/drm: introduce wlr_drm_bo_handle_tableSimon Ser
Using GBM to import DRM dumb buffers tends to not work well. By using GBM we're calling some driver-specific functions in Mesa. These functions check whether Mesa can work with the buffer. Sometimes Mesa has requirements which differ from DRM dumb buffers and the GBM import will fail (e.g. on amdgpu). Instead, drop GBM and use drmPrimeFDToHandle directly. But there's a twist: BO handles are not ref'counted by the kernel and need to be ref'counted in user-space [1]. libdrm usually performs this bookkeeping and is used under-the-hood by Mesa. We can't re-use libdrm for this task without using driver-specific APIs. So let's just re-implement the ref'counting logic in wlroots. The wlroots implementation is inspired from amdgpu's in libdrm [2]. Closes: https://github.com/swaywm/wlroots/issues/2916 [1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110 [2]: https://gitlab.freedesktop.org/mesa/drm/-/blob/1a4c0ec9aea13211997f982715fe5ffcf19dd067/amdgpu/handle_table.c
2021-08-25Move allocator stuff into new directorySimon Ser
Add render/allocator/ and include/render/allocator/ to hold everything allocator-related.
2021-08-25backend/{drm,libinput}: exclude headers when disabledSimon Ser
2021-08-24util/box: introduce wlr_fbox_transform()Kirill Primak
A floating-point version of wlr_box_transform().
2021-08-20xwayland: Allow to retrieve _NET_STARTUP_IDGuido Günther
This is use for startup notifications per startup-notifiation spec https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
2021-08-18backend/drm: add support for FB_DAMAGE_CLIPSSimon Ser
This allows the kernel to access our buffer damage. Some drivers can take advantage of this, e.g. for PSR2 panels (Panel Self Refresh) or for transfer over USB. Closes: https://github.com/swaywm/wlroots/issues/1267
2021-08-17backend/drm: use addon for wlr_drm_fbSimon Ser
2021-08-14layer-shell: replace close() with destroy()Isaac Freund
The protocol specifies that all requests (aside from destroy) are ignored after the compositor sends the closed event. Therefore, destroying the wlroots object and rendering the resource inert when sending the closed event keeps things simpler for wlroots and compositors.
2021-08-12render/gles2: make wlr_gles2_texture a wlr_buffer addonSimon Ser
2021-08-12render/gles2: make wlr_gles2_buffer an addonSimon Ser
Saves us from walking a list.
2021-08-12buffer: add addon setSimon Ser
This allows wlr_buffer users to extend it with tjeir own state.
2021-08-11surface: kill wlr_surface.previousSimon Ser
This wlr_surface_state field was a special case because we don't want to save the whole current state: for instance, the wlr_buffer must not be saved or else wouldn't get released soon enough. Let's just inline the state fields we need instead.
2021-08-11util/addon: find both by owner and implKirill Primak
This allows to have multiple addons of different types with the same owner.
2021-08-10wlr_output_layout: use wlr_addonsKirill Primak
2021-08-10wlr_outputs: add wlr_addon_setKirill Primak
2021-08-10util: add wlr_addonKirill Primak
2021-07-30render/gles2: add a few 10-bit and FP16 formatsManuel Stoeckl
The half-float formats depend on GL_OES_texture_half_float_linear, not just the GL_OES_texture_half_float extension, because the latter does not include support for linear magni/minification filters. The new 2101010 and 16161616F formats are only available on little- endian builds, since their gl_types are larger than a byte and thus endianness dependent.
2021-07-30render/gles2: hide shm formats without GL supportManuel Stoeckl
This change introduces a new function to check whether the renderer has the needed GL extensions to read a given pixel format.
2021-07-29output: drop wlr_output_state.buffer_typeSimon Ser
This is now unconditionally set to WLR_OUTPUT_STATE_BUFFER_SCANOUT.
2021-07-29output-damage: stop using enum wlr_output_state_buffer_typeSimon Ser
This enum will get dropped in the next commit.
2021-07-29output: drop wlr_output_impl.{attach,rollback}_renderSimon Ser
No backend uses these anymore.
2021-07-28backend/drm: stop initializing renderer for parent backendSimon Ser
Unless we're dealing with a multi-GPU setup and the backend being initialized is secondary, we don't need a renderer nor an allocator. Stop initializing these.
2021-07-28backend/drm: drop get_renderer implementationSimon Ser
We can now just rely on the common code for this.
2021-07-28backend/drm: drop drm_surface_{make,unset}_currentSimon Ser
2021-07-28backend/drm: remove primary swapchainSimon Ser
We can't nuke it completely, we still need it for multi-GPU.
2021-07-27render/egl: initialize wlr_egl with EGL_PLATFORM_DEVICE_EXTSimon Zeni
Uses the EXT_device_query extension to get the EGL device matching the requested DRM file descriptor. If the extension is not supported or no device is found, the EGL device will be retrieved using GBM. Depends on the EGL_EXT_device_enumeration to get the list of EGL devices.
2021-07-27xwayland: embed wlr_xwayland_server_options in server structSimon Ser
As more options are added, more fields will be duplicated. Let's just embed the struct in wlr_xwayland_server so that we don't need to keep both in sync.
2021-07-26render/egl: add support for EGL_EXT_device_drm_render_nodeSimon Ser
This EGL extension has been added in [1]. The upsides are: - We directly get a render node, instead of having to convert the primary node name to a render node name. - If EGL_DRM_RENDER_NODE_FILE_EXT returns NULL, that means there is no render node being used by the driver. [1]: https://github.com/KhronosGroup/EGL-Registry/pull/127
2021-07-22render/wlr_texture: put wlr_texture_from_buffer into the public APISimon Zeni
2021-07-22types/wlr_buffer: introduce wlr_buffer_resource_interfaceSimon Zeni
Adds `wlr_buffer_resource_interface` and `wlr_buffer_register_resource_interface`, which allows a user to register a way to create a wlr_buffer from a specific wl_resource.
2021-07-22types/wlr_buffer: remove wlr_renderer argument from wlr_buffer_from_resourceSimon Zeni
2021-07-22render: drop wlr_renderer_impl.init_wl_displaySimon Ser
Now that we have our own wl_drm implementation, there's no reason to provide custom renderer hooks to init a wl_display in the interface. We can just initialize the wl_display generically, depending on the renderer capabilities.
2021-07-22backend: make DRM and libinput backends optionalayaka
Co-authored-by: Simon Ser <contact@emersion.fr>
2021-07-20backend/drm: stop restoring CRTCs on exitSimon Ser
This is the cause of the spurious "drmHandleEvent failed" messages at exit. restore_drm_outputs calls handle_drm_event in a loop without checking whether the FD is readable, so drmHandleEvent ends up with a short read (0 bytes) and returns an error. The loop's goal is to wait for all queued page-flip events to complete, to allow drmModeSetCrtc calls to succeed without EBUSY. The drmModeSetCrtc calls are supposed to restore whatever KMS state we were started with. But it's not clear from my PoV that restoring the KMS state on exit is desirable. KMS clients are supposed to save and restore the (full) KMS state on VT switch, but not on exit. Leaving our KMS state on exit avoids unnecessary modesets and allows flicker-free transitions between clients. See [1] for more details, and note that with Pekka we've concluded that a new flag to reset some KMS props to their default value on compositor start-up is the best way forward. As a side note, Weston doesn't restore the CRTC by does disable the cursor plane on exit (see drm_output_deinit_planes, I still think disabling the cursor plane shouldn't be necessary on exit). Additionally, restore_drm_outputs only a subset of the KMS state. Gamma and other atomic properties aren't accounted for. If the previous KMS client had some outputs disabled, restore_drm_outputs would restore a garbage mode. [1]: https://blog.ffwll.ch/2016/01/vt-switching-with-atomic-modeset.html
2021-07-19buffer: re-use wlr_shm_client_bufferSimon Ser
The first time wlr_buffer_from_resource is called with a wl_buffer resource that originates from wl_shm, create a new wlr_shm_client_buffer as usual. If wlr_buffer_from_resource is called multiple times, re-use the existing wlr_shm_client_buffer. This commit changes how the wlr_shm_client_buffer lifetime is managed: previously it was destroyed as soon as the wlr_buffer was released. With this commit it's destroyed when the wl_buffer resource is. Apart from de-duplicating wlr_shm_client_buffer creations, this allows to easily track when a wlr_shm_client_buffer is re-used. This is useful for the renderer and the backends, e.g. the Pixman renderer can keep using the same Pixman image if the buffer is re-used. In the future, this will also allow to re-use resources in the Wayland and X11 backends (remote wl_buffer objects for Wayland, pixmaps for X11).
2021-07-19input/pointer: send axis source once per frameVyivel
Only one wl_pointer.axis_source event is permitted per frame, according to the Wayland specification. Fixes https://github.com/swaywm/wlroots/issues/2973
2021-07-12output: remove wlr_output_impl.export_dmabufSimon Ser
No backend is using it anymore.
2021-07-12backend/headless: remove wlr_output_impl.export_dmabufSimon Ser
This is now provided by the generic wlr_output implementation.
2021-07-12output: add generic wlr_output_export_dmabuf implementationSimon Ser
When wlr_output manages its own swap-chain, there's no need to hook into the backend to grab DMA-BUFs. Instead, maintain a wlr_output.front_buffer field with the latest committed buffer.
2021-07-12buffer: drop resource arg from wlr_client_buffer_createSimon Ser
This function doesn't need the wl_resource anymore. In the failure paths, wlr_buffer_unlock in surface_apply_damage will take care of sending wl_buffer.release.
2021-07-12render/gles2: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-12render/egl: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-09buffer: drop wlr_client_buffer.resourceSimon Ser
2021-07-09buffer: add wlr_client_buffer.sourceSimon Ser
This stores a weak reference to the source buffer.
2021-07-09buffer: stop using source resource in wlr_client_buffer_apply_damageSimon Ser
This is the first step towards dropping wlr_client_buffer.resource.
2021-07-09types/wlr_buffer: remove wlr_resource_get_buffer_sizeSimon Zeni
2021-07-09types/wlr_surface: get buffer size from wlr_buffer_importSimon Zeni
2021-07-09types/wlr_buffer: split wlr_client_buffer_import functionSimon Zeni
`wlr_client_buffer_import` is splitted in two distincts function: - wlr_buffer_from_resource, which transforms a wl_resource into a wlr_buffer - wlr_client_buffer_create, which creates a wlr_client_buffer from a wlr_buffer by creating a texture from it and copying its wl_resource
2021-07-09backend/drm: remove backend arg from wlr_drm_interface.crtc_commitSimon Ser
The callee can just get it from the wlr_drm_connector.
2021-07-09backend/drm: add test_only arg to wlr_drm_interface.crtc_commitSimon Ser
Right now callers of drm_crtc_commit need to check whether the interface is legacy or atomic before passing the TEST_ONLY flag. Additionally, the fallbacks for legacy are in-place in the common code. Add a test_only arg to the crtc_commit hook. This way, there's no risk to pass atomic-only flags to the legacy function (add an assert to ensure this) and all of the legacy-specific logic can be put back into legacy.c (done in next commit).