aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
AgeCommit message (Collapse)Author
2021-06-17backend/drm: populate cursor plane's current_fbSimon Ser
The set_cursor() hook is a little bit special: it's not really synchronized to commit() or test(). Once set_cursor() returns true, the new cursor is part of the current state. This fixes a state where wlr_drm_connector.cursor_enabled is true but there is no FB available. This is triggered by set_cursor() followed by a failed commit(), which resets pending_fb. We should definitely fix the output interface to make the cursor part of the pending state, but that's a more involved change.
2021-06-13backend/drm: remove test_bufferSimon Ser
Instead, call drm_connector_set_pending_fb.
2021-06-13backend/drm: move session check from test_buffer to drm_connector_testSimon Ser
The other caller (drm_connector_commit_state) already checks this.
2021-06-13backend/drm: move drm_connector_set_pending_fb upSimon Ser
This will be used in drm_connector_test shortly.
2021-06-13backend/drm: allocate a CRTC in drm_connector_testSimon Ser
We can't perform a test-only atomic commit if the connector is missing a CRTC.
2021-06-13backend/drm: allocate a CRTC in drm_connector_commit_stateSimon Ser
drm_connector_set_pending_fb needs a CRTC to import the buffer.
2021-06-13backend/drm: introduce drm_connector_alloc_crtcSimon Ser
This function allocates a CRTC for a connector if necessary.
2021-06-13backend/drm: allow committing a buffer and a mode togetherSimon Ser
Set the plane's pending FB before calling drm_connector_set_mode.
2021-06-13backend/drm: use atomic test-only commits for modifier fallbackSimon Ser
Instead of trying to perform a real modeset in init_renderer, perform an atomic test-only commit to find out whether disabling modifiers is necessary because of bandwidth limitations. This decouples init_renderer from the actual commit, making it possible to modeset an output with a user-supplied buffer instead of a black frame. We loose the ability to make sure the buffers coming from the swapchain will work fine when using the legacy interface. This can break i915 when atomic is disabled and modifiers enabled. But i915 always has atomic (so the user must explicitly disable it to run into potential bandwidth limitations) and is the only known problematic driver.
2021-06-09render: drop wlr_ prefix from wlr_renderer_bind_bufferSimon Ser
Make it clear this function is a private wlroots API and will stay that way.
2021-06-02backend/drm: move cursor fields to wlr_drm_connectorSimon Ser
Doesn't make a lot of sense to split the cursor fields between wlr_drm_plane and wlr_drm_connector. Let's just move everything to wlr_drm_connector.
2021-06-02output: take a wlr_buffer in set_cursorSimon Ser
Instead of passing a wlr_texture to the backend, directly pass a wlr_buffer. Use get_cursor_size and get_cursor_formats to create a wlr_buffer that can be used as a cursor. We don't want to pass a wlr_texture because we want to remove as many rendering bits from the backend as possible.
2021-06-02backend/drm: introduce drm_plane_pick_render_formatSimon Ser
This is a new helper function to pick a render format suitable for a plane. The next commit will use it to initialize the cursor multi-GPU surface.
2021-06-02backend/drm: remove format arg from drm_plane_init_surfaceSimon Ser
This was always set to ARGB8888.
2021-06-02backend/drm: implement get_cursor_formats and get_cursor_sizeSimon Ser
2021-05-21backend: introduce wlr_backend_finishSimon Ser
This new functions cleans up the common backend state. While this currently only emits the destroy signal, this will also clean up the renderer and allocator in upcoming patches.
2021-05-17backend/drm: use wlr_texture_from_bufferSimon Ser
2021-04-30backend/drm: Do not require mode commit on enableKenny Levinsen
If a mode is not provided, use the current mode intead. Closes: https://github.com/swaywm/wlroots/issues/2904
2021-04-29backend/drm: introduce drm_connector_commit_stateSimon Ser
Backend-initiated mode changes can use this function instead of going through drm_connector_set_mode. drm_connector_set_mode becomes a mere drm_connector_commit_state helper.
2021-04-29backend/drm: take a wlr_drm_connector instead of a wlr_outputSimon Ser
No need to take a generic wlr_output, we already know the output comes from the DRM backend at that point.
2021-04-29backend/drm: take output state arg in drm_connector_commit_bufferSimon Ser
This will allow a whole state to be applied at once, instead of individually applying the buffer and the mode.
2021-04-29backend/drm: remove mode arg from drm_connector_set_modeSimon Ser
All of the information is in wlr_output_state.
2021-04-29backend/drm: remove mode arg from drm_connector_init_rendererSimon Ser
This is now unused.
2021-04-29backend/drm: remove wlr_drm_crtc_state.modeSimon Ser
Replace it with drm_connector_state_mode, which computes the mode from the wlr_output_state to be applied.
2021-04-29backend/drm: remove wlr_drm_crtc_state.activeSimon Ser
Replace it with drm_connector_state_active, which figures out whether the connector is active depending on the wlr_output_state to be applied.
2021-04-29backend/drm: remove wlr_drm_crtc.pending_modesetSimon Ser
Replace it with a new drm_connector_state_is_modeset function that decides whether a modeset is necessary directly from the wlr_output_state which is going to be applied.
2021-04-29backend/drm: fill scratch wlr_output_state for set_modeSimon Ser
Populate the wlr_output_state when setting a mode. This will allow drm_connector_set_mode to stop relying on ephemeral fields in wlr_drm_crtc. Also drm_connector_set_mode will be able to apply both a new buffer and a new mode atomically.
2021-04-29backend/drm: take wlr_output_state as arg in commit callersSimon Ser
Instead of relying on wlr_output.pending to be empty when performing backend-initiated CRTC commits, use a zero wlr_output_state.
2021-04-29backend/drm: take wlr_output_state as arg in crtc_commitSimon Ser
Stop assuming that the state to be applied is in output->pending in crtc_commit. This will allow us to remove ephemeral fields in wlr_drm_crtc, which are used scratch fields to stash temporary per-commit data.
2021-04-29backend/drm: fix allocator DRM FD on multi-GPU setupsSimon Ser
On multi-GPU setups, there is a primary DRM backend and secondary DRM backends. wlr_backend_get_drm_fd will always return the parent DRM FD even on secondary backends, so that users always use the primary device for rendering. However, for our internal rendering we want to use the secondary device. Use allocator_autocreate_with_drm_fd to make sure the allocator will create buffers on the secondary device. We do something similar to ensure our internal rendering will happen on the secondary device with renderer_autocreate_with_drm_fd. Fixes: cc1b66364cc9 ("backend: use wlr_allocator_autocreate")
2021-04-29render: remove wlr_ prefix from wlr_renderer_autocreate_with_drm_fdSimon Ser
This function is only required because the DRM backend still needs to perform multi-GPU magic under-the-hood. Remove the wlr_ prefix to make it clear it's not a candidate for being made public.
2021-04-29backend/drm: reword wlr_renderer failure messageSimon Ser
Remove the assumption about EGL.
2021-04-28backend: use wlr_allocator_autocreateSimon Zeni
2021-04-28backend: introduce backend_get_buffer_capsSimon Zeni
2021-04-28render/gbm_allocator: make wlr_gbm_allocator_create return a wlr_allocatorSimon Zeni
2021-04-27Revert "backend/drm: fail instead of stripping a modifier"Simon Ser
This reverts commit f9f90b417366581b58d806956c9b2099417ed4b3. gbm_bo_get_modifier may return a modifier in these cases: - The kernel doesn't support modifiers but Mesa does - WLR_DRM_NO_MODIFIERS=1 is set However, in both of these cases, the gbm_bo has been allocated without modifiers. There is already a check in drm_fb_create for modifiers: wlr_drm_format_set_has will make sure buffers with an explicit modifier will be rejected if the DRM backend doesn't support them. So no need for an additional check in get_fb_for_bo. Closes: https://github.com/swaywm/wlroots/issues/2896
2021-04-27backend/drm: carry on when disabling a CRTC failsSimon Ser
On GPU unplug, disabling a CRTC can fail with EPERM. References: https://github.com/swaywm/wlroots/pull/2575#issuecomment-761771264
2021-04-27backend/drm: destroy backend on udev remove eventSimon Ser
Any use of the DRM FD after the remove event results in a "Permission denied" error.
2021-04-27backend/drm: destroy when parent is destroyedSimon Ser
2021-04-26backend/drm: clarify error message on drmModeAddFB fallbackSimon Ser
The previous code would always print "falling back to legacy method", even if the format wasn't ARGB8888. Drop get_fb_for_bo_legacy, since the code can just be inlined without hurting readability. Ideally we should only fallback to drmModeAddFB if the error code indicates the BE failure, but the original PR [1] doesn't say what error code is returned by the kernel. [1]: https://github.com/swaywm/wlroots/pull/2569
2021-04-26backend/drm: fail instead of stripping a modifierSimon Ser
We shouldn't strip a modifiers from buffers, because the will make the kernel re-interpret the data as LINEAR on most drivers, resulting in an incorrect output on screen.
2021-04-15render: rename get_dmabuf_render_formats into get_render_formatsSimon Zeni
2021-04-14backend/drm: terminate display on drmHandleEvent failureSimon Ser
2021-04-10drm: check for PRIME supportStephan Hilb
PRIME support for buffer sharing has become mandatory since the renderer rewrite. Make sure we check for the appropriate capabilities in backend, allocator and renderer. See also #2819.
2021-04-06backend/drm: stop testing for buffer in drm_connector_commit_bufferSimon Ser
We now do the test in drm_connector_test, called from drm_connector_commit.
2021-04-06backend/drm: use atomic test-only commits for direct scan-outSimon Ser
This allows callers to use wlr_output_test to figure out whether a buffer can be scanned out prior to committing the output.
2021-04-06backend/drm: downgrade test-only commit failure log levelSimon Ser
Let's not clutter the logs with error messages when a test-only atomic commit fails.
2021-04-06backend/drm: don't set NONBLOCK with TEST_ONLYSimon Ser
The kernel ignores NONBLOCK when TEST_ONLY is set. Let's just not set it, to make it clear it's unused.
2021-04-06backend/drm: reject DMA-BUFs with flagsSimon Ser
We cannot scan-out DMA-BUFs with any flag right now.
2021-04-06backend/drm: improve logs in drm_fb_createSimon Ser
Downgrade errors to DEBUG level, because drm_fb_create is used in test_buffer, so errors aren't always fatal. Add ERROR logs at call sites where a failure is fatal, to make it clear something wrong happened.