aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
AgeCommit message (Collapse)Author
2023-08-16backend/drm: Use output state to set init modeAlexander Orzechowski
2023-08-16backend/drm: Move output variable up in connect_drm_connectorAlexander Orzechowski
2023-08-16output: Add initialization state to wlr_output_initAlexander Orzechowski
2023-07-14backend/drm: stop checking for wlr_client_bufferSimon Ser
wlr_client_buffer is a bad indicator for direct scan-out. Compositors might use the underlying wlr_buffer instead.
2023-07-11Use wl_container_of() instead of castsSimon Ser
This slightly improves type safety. The culprits were found with: git grep -E '\([a-z0-9_ ]+ \*\)\W?[a-z]'
2023-07-07Use struct initializers instead of memset()Simon Ser
This is a bit more type-safe.
2023-06-30backend/drm: use panel_orientation if it is setClayton Craft
This fixes an issue where the panel_orientation parameter was set but wlroots was ignoring it and returning OUTPUT_TRANSFORM_NORMAL. Fixes 2e12de96
2023-06-27output: Set output mode during main commitAlexander Orzechowski
Removes duplication across all the backends to finally apply the mode to the output.
2023-06-27backend/drm: Don't add pollute fixed modes list with custom modesAlexander Orzechowski
Nobody remembers why this is done and it isn't that great if people use a lot of custom modes.
2023-06-26backend/drm: remove duplicate needs_frame() in set_cursor()Simon Ser
wlr_output_update_needs_frame() is called unconditionally at the end of the function already.
2023-06-23output: add wlr_output_state_init()Simon Ser
This changes the semantics of wlr_output_state. Instead of having fields with uninitialized memory when missing from the committed bitflag, all fields are always initialized (and maybe NULL/empty), just like we do in wlr_surface_state. This reduces the chances of footguns when reading a field, and removes the need to check for the committed bitfield everywhere. A new wlr_output_state_init() function takes care of initializing the Pixman region.
2023-06-22backend/drm: fix libliftoff_plane double-freeSimon Ser
Destroying the liftoff_device invalidates all of the liftoff_planes. Destroy the liftoff_planes before the liftoff_device to fix this.
2023-06-21backend/drm: Fix typoAlexander Orzechowski
2023-05-31backend/drm: introduce wlr_drm_mode_get_info()Simon Ser
This allows compositors to get back the raw drmModeModeInfo and look at DRM-specific fields and flags.
2023-05-11wlr_drm_format: Rework wlr_drm_format_intersectAlexander Orzechowski
Now it takes a reference to a destination format
2023-05-11wlr_drm_format: Introduce drm_format_finishAlexander Orzechowski
2023-03-20backend/drm: log drm_connector_alloc_crtc() failuresSimon Ser
Helps figuring out why e.g. get_primary_formats fails.
2023-02-28backend/drm: use libdisplay-info for CVT mode generationSimon Ser
2023-02-21render/swapchain: make publicSimon Ser
We've had this struct for a while. It'd be useful for compositors if they want to manage the swap chains themselves instead of being forced to use wlr_output's. Some compositors might also want to use a swapchain without an output.
2023-02-21backend/drm: drop wlr_drm_layer.pending_{width,height}Simon Ser
No need to store this info in struct wlr_drm_layer. We can just extract the size when we need it.
2023-02-20backend/drm: send output layer feedback eventsSimon Ser
2023-02-20backend/drm: add support for output layersSimon Ser
2023-02-20backend/drm: add libliftoff interfaceSimon Ser
2023-02-20backend/drm: init wlr_drm_plane for all plane typesSimon Ser
2023-01-31backend/drm: set "max bpc" property based on pixel formatSimon Ser
Since 1d581656c756 ("backend/drm: set "max bpc" to the max") we set the "max bpc" property to the maximum value. The kernel driver is supposed to clamp this value depending on hardware capabilities. All kernel drivers lower the value depending on the GPU capabilities. However, none of the drivers lower the value depending on the DP-MST link capabilities. Thus, enabling a 4k@60Hz mode can fail on some DP-MST setups due to the "max bpc" property. Additionally, it's not a good idea to unconditionally set "max bpc" to the max. A high bpc consumes more lanes and more clock speed, which means higher power consumption and the busy lanes cannot be used for something else (e.g. other data transfers on a USB-C cable). For now, let's tie the "max bpc" to the pixel format of the buffer. Introduce a heuristic to make "high bit-depth buffer" a synonym of "I want the best quality". This is not perfect: a "max bpc" higher than 8 might be desirable for pixel formats with a color depth of 8 bits, for instance when the color management KMS properties are used. But we don't really support that yet, so let's leave this for later. Closes: https://github.com/swaywm/sway/issues/7367
2022-12-16backend/drm: check return value of get_drm_{connector,crtc}_props()Simon Ser
We already do it for get_drm_plane_props().
2022-12-15backend/drm: remove wlr_drm_crtc.legacy_crtcSimon Ser
We only need it for one thing: gamma size. Moreover, some bits in the drmModeCrtc will become out-of-date, for instance the current mode, so let's avoid caching the whole struct and only keep what we know won't change.
2022-12-15backend/drm: fetch fresh legacy CRTC in connector_get_current_mode()Simon Ser
connect_drm_connector() may be called long after create_drm_connector(). During that time the DRM mode might have changed. Avoid working with stale information.
2022-12-13backend/drm: drop unused arg in connector_get_current_mode()Simon Ser
2022-12-13backend/drm: prevent out-of-bounds array access on unknown subpixelSimon Ser
If the kernel adds new enum entries for subpixel, don't read past the end of the subpixel_map array.
2022-12-13backend/drm: refuse to switch CRTC for enabled connectorSimon Ser
match_obj() might return a configuration where the CRTC for an enabled connector is switched to another one. We don't support this correctly: the wlr_output common code would need to query again the supported formats, re-allocate the swapchain, etc. What's more, the kernel doesn't even support this [1]: it requires planes to be disabled to change their CRTC, it rejects commits directly switching the CRTC used by a plane. [1]: https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_atomic.c?h=6e90293618ed476d6b11f82ce724efbb9e9a071b#n697
2022-12-13backend/drm: rename wlr_drm_backend.outputs to connectorsSimon Ser
This list contains wlr_drm_connector entries, and there is no guarantee that the wlr_output fields are initialized.
2022-12-13backend/drm: clear pending cursor FB in drm_connector_commit_state()Simon Ser
Ensure we unlock any pending cursor FB when disabling a connector.
2022-12-13backend/drm: update wlr_drm_connnector.crtc in drm_connector_commit_state()Simon Ser
If the commit fails, then our local state becomes out-of-sync with the kernel's. Additionally, when disabling a connector without going through dealloc_crtc(), conn->crtc would still be set. Fix this by updating conn->crtc in drm_connector_commit_state().
2022-12-13backend/drm: print stringified connector status in realloc_crtcs()Simon Ser
The raw enum value wasn't informative enough. It's not trivial to tell whether 0 means connected or disconnected. Drop the status from the state after realloc, since the exact same information is printed right above.
2022-12-07backend/drm: store pending FB in stateSimon Ser
Instead of having a pending_fb field on the struct wlr_drm_plane, move it to struct wlr_drm_connector_state. That way, there's no risk having a stale pending FB around: the state doesn't survive across tests and commits. The cursor is a special case because it's disconnected from the atomic state: the wlr_backend_impl.set_cursor hook sets the cursor for the next commit. Move the field to wlr_drm_connector.cursor_pending_fb.
2022-12-07backend/drm: use separate field to store pending cursor FBSimon Ser
We'll move the pending primary FB into the connector state in the next commit, dropping wlr_drm_plane.pending_fb in the process. Introduce a dedicated field for the cursor, which has to be managed in a special way due to our set_cursor API.
2022-12-07backend/drm: simplify dealloc_crtc() commitSimon Ser
No need to manually call drm_connector_state_init() here, we can just let drm_connector_commit_state() handle it.
2022-12-07backend/drm: fix VRR testSimon Ser
We were calling drm_connector_supports_vrr() before drm_connector_alloc_crtc(). Thus, when an output is currently off, the VRR test would always fail, because it checks that the vrr_enabled CRTC prop exists.
2022-11-17backend/drm: don't damage output on CRTC changeSimon Ser
There's no reason why the output should be damaged here. The current buffer doesn't need to be re-painted.
2022-11-17output: call wlr_output_update_enabled() after commitSimon Ser
Backends no longer need to manually call wlr_output_update_enabled() in their commit hook: wlr_output will take care of that.
2022-11-15backend/drm: only request page-flip if activeSimon Ser
It doesn't make sense to request a page-flip for a disabled output. Fixes: 84e727daae67 ("backend/drm: request page-flip event on modeset") Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3528
2022-11-15backend/drm: fix FPE when disabling outputSimon Ser
Fixes: 65836ce357e4 ("backend/drm: log modesetting commits") Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3534
2022-11-14backend/drm: log modesetting commitsSimon Ser
2022-11-14backend/drm: log refresh rate in HzSimon Ser
2022-11-11backend/drm: request page-flip event on modesetSimon Ser
The old drm_connector_set_mode() function did that by calling drm_crtc_page_flip(). We lost this in the refactoring. Fixes: f216e979836a ("backend/drm: drop drm_connector_set_mode()")
2022-11-02backend/drm: get possible CRTCs in create_drm_connector()Simon Ser
This stuff is immutable for a given connector.
2022-11-02backend/drm: extract create_drm_connector()Simon Ser
Move a bit more logic out of the big loop in scan_drm_connectors().
2022-10-19backend/drm: fetch current CRTC once on startupSimon Ser
Once we are DRM master, the CRTC cannot be changed behind our back except during a VT switch. After a VT switch, we try to restore whatever KMS state we had last programmed. Reloading the current CRTC from KMS breaks this and can result in a modeset without a FB. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3432
2022-10-17backend/drm: drop drm_crtc_page_flip()Simon Ser
Inline it in drm_connector_commit_state(). Brings us a step closer to unifying the test code-path and the commit code-path.