aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
AgeCommit message (Collapse)Author
2022-08-22Use env helpersAlexander Orzechowski
2022-08-18Use wl_signal_emit_mutableAlexander Orzechowski
2022-08-10backend/drm: drop enum wlr_drm_connector_statusSimon Ser
We can just use libdrm's drmModeConnection enum instead.
2022-08-10backend/drm: drop WLR_DRM_CONN_NEEDS_MODESETSimon Ser
- Add wlr_output.enabled checks to CONNECTED checks - Replace NEEDS_MODESET with CONNECTED
2022-07-25backend/drm: use drmModeConnectorGetPossibleCrtcsSimon Ser
This function has been merged in libdrm. References: https://gitlab.freedesktop.org/mesa/drm/-/commit/3ee004ef529f43366fdd1f4d32b26872cc82c6ca
2022-07-25backend/drm: use drmModeGetConnectorTypeNameSimon Ser
No need to manually maintain this table now. The wlroots names and the libdrm (= kernel) names all match. References: https://gitlab.freedesktop.org/mesa/drm/-/commit/50f8d517733d24fce6693ffae552f9833e2e6aa9
2022-06-19backend/drm: set "max bpc" to the maxSimon Ser
"max bpc" is a maximum value, the driver is free to choose a smaller value depending on the bandwidth available. Some faulty monitors misbehave with higher bpc values. We'll add a workaround if users get hit by these in practice. References: https://gitlab.freedesktop.org/wayland/weston/-/issues/612
2022-06-19backend/drm: remove unused CRTC count checkSimon Ser
drmIsKMS already checks for this.
2022-06-07backend/drm: fix NULL pointer deference due to typoIsaac Freund
2022-06-07backend/drm: make serial optionalSimon Ser
The EDID 1.4 spec says that the serial number is optional: > If this field is not used, then enter “00h, 00h, 00h, 00h”. Leave the wlr_output.serial field NULL in that case, and hide it from the output description.
2022-06-07backend/drm: unconditionally set "content type" to graphicsSimon Ser
CTA-861-G says that "graphics" is used to indicate non-analog (ie, digital) content. With that bit set, the sink should turn off analog reconstruction and other related filtering.
2022-06-02backend/drm: fix check for no-op commitsIsaac Freund
Since 6936e163b, we short-circut no-op commits as an optimization. However, the logic in the check was slightly off.
2022-06-02backend/drm: short-circuit no-op commitsSimon Ser
Some output commits (changing e.g. the output scale or transform) don't require any change in the KMS state. Instead of going through a KMS commit, return early. Blocking KMS commits can be expensive.
2022-06-01backend/drm: make commits without a buffer blockingSimon Ser
The wlr_output API requires compositors to wait for wlr_output.frame before submitting a new buffer. However, compositors can perform a commit which doesn't involve a buffer anytime. If the commit is a modeset, we set DRM_MODE_ATOMIC_ALLOW_MODESET and block until the commit is done. If it isn't, we currently always perform a non-blocking commit. This is an issue because a previous page-flip might still be in flight kernel-side, returning EBUSY. Fix this by using blocking commits when a buffer isn't submitted by the compositor. Closes: https://github.com/swaywm/sway/issues/6962 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2239
2022-05-31backend/drm: improve atomic commit flag loggingSimon Ser
We weren't logging all of the flags, which made debugging more difficult.
2022-05-30output: pass wlr_output_state to backendSimon Ser
Groundwork for the following commits. The goal is to allow users to specify their own wlr_output_state instead of wlr_output.pending.
2022-05-26backend/drm: fix crash with null serialvaxerski
backend/drm: use serial_str instead
2022-05-26output: turn make/model/serial into char *Simon Ser
This allows the make/model/serial to be NULL when unset, and allows them to be longer than the hardcoded array length. This is a breaking change: compositors need to handle the new NULL case, and we stop setting make/model to useless "headless" or "wayland" strings.
2022-05-26backend/drm: fix crash in init_drm_surfaceSimon Ser
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3434
2022-05-25backend/drm: remove wlr_drm_surface.{width,height}Simon Ser
This information is stored in wlr_swapchain, no need to duplicate it.
2022-05-24backend/drm: allow non-linear modifiers for multi-GPUSimon Ser
Prior to [1], if an entry in a DRM format set was different than a single LINEAR modifier, implicit modifiers were always allowed. This has changed and now implicit modifiers are only allowed if INVALID is in the list of modifiers. So now we can safely enable explicit modifiers for cross-GPU imports, without risking receiving buffers with an implicit modifier. This should improve perf a bit on setups where two GPUs from the same vendor are used. This fixes the first bullet point from [2]. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3231 [2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3331
2022-05-11backend/drm: fetch EDID manufacturer from udev_hwdbSimon Ser
Maintaining our internal table up-to-date is tedious: one needs to manually go through the PnP ID registry [1] and check whether we're missing any entry. udev_hwdb already has an API to fetch a manufacturer name from its PnP ID. Use that instead. [1]: https://uefi.org/pnp_id_list
2022-04-28Zero-initialize structs in init functionsSimon Ser
Ensures there is no field left to its previous undefined value after calling an init function.
2022-03-13Pass O_CLOEXEC to drmModeCreateLease callsSamuel Čavoj
The lease_fd is currently being leaked to child processes Link: https://github.com/swaywm/sway/issues/4286#issuecomment-1065987957
2021-12-14backend/drm: use drmCloseBufferHandleSimon Ser
This has been added in [1] and allows us to close buffer handles without manually calling drmIoctl. [1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/192
2021-12-14backend/drm: use drmModeFormatModifierBlobIterNextSimon Ser
This avoids open-coding our own logic. The resulting code is more readable. References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146
2021-12-13backend/drm: add wlr_drm_backend_monitorChris Chamberlain
This helper is responsible for listening for new DRM devices and create new child DRM backends as necessary.
2021-12-09output: introduce wlr_output_set_nameSimon Ser
wlroots picks names for all outputs, but it might be desirable for compositor to override it. For instance, Sway will use a headless output as a fallback in case no outputs are connected. Sway wants to clearly label the fallback output as such and label "real" headless outputs starting from HEADLESS-1.
2021-11-29backend/drm: poison buffers which cannot be scanned outSimon Ser
Rather than repeatedly trying to import DMA-BUFs which cannot be scanned out, mark the failed ones with a special "poison" marker. Inspired from [1]. [1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/731
2021-11-26backend/drm: always add LINEAR to supported modifiersSimon Ser
2021-11-26backend/drm: fail on explicit modifier in drmModeAddFB2Simon Ser
drmModeAddFB2 doesn't support explicit modifiers. Only accept INVALID which indicates an implicit modifier and LINEAR which may indicate that GBM_BO_USE_LINEAR has been used.
2021-11-26Require INVALID for implicit format modifiersSimon Ser
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-11-19backend/drm: scan leases on ueventSimon Ser
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3181
2021-11-19backend/drm: introduce wlr_drm_leaseSimon Ser
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3183
2021-11-18backend/drm: stop initializing backend rendererSimon Zeni
2021-11-17Remove support for DMA-BUF flagsSimon Ser
They are never used in practice, which makes all of our flag handling effectively dead code. Also, APIs such as KMS don't provide a good way to deal with the flags. Let's just fail the DMA-BUF import when clients provide flags.
2021-11-02backend/drm: handle per-connector hotplug eventsSimon Ser
When a connector ID is specified in a hotplug event, don't scan all connectors. Only scan the connector that has changed.
2021-10-29backend/drm: avoid creating empty FB_DAMAGE_CLIPS propSimon Ser
drmModeCreatePropertyBlob cannot create zero-sized blobs, that fails with EINVAL. Closes: https://github.com/swaywm/wlroots/issues/3297
2021-10-29backend/drm: get rid of BO handle tableSimon Ser
The BO handle table exists to avoid double-closing a BO handle, which aren't reference-counted by the kernel. But if we can guarantee that there is only ever a single ref for each BO handle, then we don't need the BO handle table anymore. This is possible if we create the handle right before the ADDFB2 IOCTL, and close the handle right after. The handles are very short-lived and we don't need to track their lifetime. Because of multi-planar FBs, we need to be a bit careful: some FB planes might share the same handle. But with a small check, it's easy to avoid double-closing the same handle (which wouldn't be a big deal anyways). There's one gotcha though: drmModeSetCursor2 takes a BO handle as input. Saving the handles until drmModeSetCursor2 time would require us to track BO handle lifetimes, so we wouldn't be able to get rid of the BO handle table. As a workaround, use drmModeGetFB to turn the FB ID back to a BO handle, call drmModeSetCursor2 and then immediately close the BO handle. The overhead should be minimal since these IOCTLs are pretty cheap. Closes: https://github.com/swaywm/wlroots/issues/3164
2021-10-27backend/drm/legacy.c: Fix memory leak in drm_legacy_crtc_set_gammaHaelwenn (lanodan) Monnier
Found via scan-build
2021-10-26backend/drm: add entry for Valve EDID vendorSimon Ser
As found in e.g. the Steam Deck.
2021-10-15output: add presented flag to presentation eventKirill Primak
2021-10-02Fix spelling errorsElyes HAOUAS
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-01Revert "Require INVALID for implicit format modifiers"Simon Ser
This reverts commit ea7357b70366588069c83f158e6a4eb2d3a702b3.
2021-10-01Revert "backend/drm: fail on explicit modifier in drmModeAddFB2"Simon Ser
This reverts commit d6be1d68b7d0542efa4dc2d19d57531484fe330a.
2021-10-01backend/drm: fail on explicit modifier in drmModeAddFB2Simon Ser
drmModeAddFB2 doesn't support explicit modifiers. Only accept INVALID which indicates an implicit modifier and LINEAR which may indicate that GBM_BO_USE_LINEAR has been used.
2021-10-01Require INVALID for implicit format modifiersSimon Ser
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-09-30backend: create renderer and allocator in wlr_backend_autocreateSimon Ser
Instead of ensuring the renderer and allocator are initialized in each backend, do it in wlr_backend_autocreate. This allows compositors to create backends without any renderer/allocator if they side-step wlr_backend_autocreate. Since the wlr_backend_get_renderer and backend_get_allocator end up calling wlr_renderer_autocreate and wlr_allocator_autocreate, it sounds like a good idea to centralize all of the opimionated bits in one place.
2021-09-21backend/drm: add support for panel orientationSimon Ser
Expose the panel orientation with wlr_drm_connector_get_panel_orientation. Leave it to the compositor to consume this information and configure the output accordingly. Closes: https://github.com/swaywm/wlroots/issues/1581
2021-09-08backend/drm: introduce wlr_drm_backend_get_non_master_fdSimon Zeni