aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
AgeCommit message (Collapse)Author
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.
2021-04-06backend/drm: try to import buffer when testing itSimon Ser
If the import to KMS succeeds, we have a better chance to be able to scan it out. Importing is also necessary for test-only commits, which we want to add in the future.
2021-03-31backend/drm: use format table in test_bufferSimon Ser
Instead of an ad-hoc strip_alpha_channel function, use the centralized format table to get an opaque substitute.
2021-03-25backend/drm: use pixel format table in rendererSimon Zeni
2021-03-16Fix buffer blit matricesSimon Ser
There was a missing wlr_matrix_scale call, so we ended up with black frames. Closes: https://github.com/swaywm/wlroots/issues/2780
2021-03-11output: fix transform matrix for 90/270 rotationsSimon Ser
We need to adjust the second translation depending on the transform we applied. Fixes: 9601a2abf024 ("output: improve transform matrix calculation" Closes: https://github.com/swaywm/wlroots/issues/2774
2021-03-10output: improve transform matrix calculationSimon Zeni
Compute only the transform matrix in the output. The projection matrix will be calculated inside the gles2 renderer when we start rendering. The goal is to help the pixman rendering process.
2021-03-05backend/drm: add new writeback and SPI connector typesSimon Ser
We already depend on libdrm 2.4.95, which is the first to have the writeback connector type.
2021-02-18backend: add error messages in attach_render implsSimon Ser
2021-02-05Make implementation function lists static constManuel Stoeckl
This requires a change to the type of `struct wlr_tablet` and `wlr_tablet_init` signature, both of which are part of the unstable API.
2021-01-24backend/drm: don't blit in drm_fb_importSimon Ser
Instead blit in drm_plane_lock_surface. This makes drm_fb_import simpler and better fits its name.
2021-01-24backend/drm: simplify drm_fb_lock_surfaceSimon Ser
Make it take a plane instead, and rename to drm_plane_lock_surface.
2021-01-17backend/drm: fix modifiers for cursor plane buffersSimon Ser
In 93cd3a79b26c ("backend/drm: stop using GBM flags"), we stopped using the GBM_BO_USE_LINEAR flag in favor of a modifier list set to { DRM_FORMAT_MOD_LINEAR }. However, the last argument of drm_plane_init_surface disables modifiers -- so the buffer will just get allocated with an implicit modifier, without necessarily being LINEAR. To fix this, allow modifiers when allocating the cursor buffers. wlr_drm_plane.formats should already have the necessary LINEAR restrictions. Fixes: 93cd3a79b26c ("backend/drm: stop using GBM flags")
2021-01-17backend/drm: add wlr_drm_connector_get_idSimon Ser
This allows a compositor to get a KMS connector object ID from a wlr_output. The compositor can then query more information about the connector via libdrm. This gives more freedom to compositors and allows them to read KMS properties that wlroots doesn't know about. For instance, they could read the EDID or the suggested_{X,Y} properties and change their output configuration based on that.
2021-01-17backend/drm: add support for the subconnector propertySimon Ser
The subconnector property indicates the connector sub-type. This is useful because that usually indicates what kind of connector the user has plugged in to their monitor, e.g. a DisplayPort-to-DVI cable will indicate a DVI subconnector. Also some laptops have non-DP connectors that are internally linked to a DP port on the GPU. Set the output description accordingly. See https://drmdb.emersion.fr/properties/3233857728/subconnector
2021-01-16backend/drm: use local DRM FD for wlr_rendSimon Ser
The new wlr_renderer_autocreate API is great for compositors, however it causes some issues with DRM multi-GPU support. A DRM child backend wants the compositor to use the parent GPU, so it exposes the parent's DRM FD in get_drm_fd. However, in order to be able to perform multi-GPU buffer copies, the child DRM backend still needs to create a local renderer. Use the new private wlr_renderer_autocreate_with_drm_fd function to avoid creating a renderer for the parent GPU. Fixes: e128e6c08dc0 ("render: drop egl parameters from wlr_renderer_autocreate")
2021-01-16render/gles2: make EGL context current in bind_bufferSimon Ser
Instead of requiring callers to manually make the EGL context current before binding a buffer and unsetting it after unbinding a buffer, do it inside wlr_renderer_bind_buffer. This hides renderer-specific implementation details inside the wlr_renderer interface. Non-GLES2 renderers may not use EGL. This removes all EGL dependencies from the backends. References: https://github.com/swaywm/wlroots/issues/2618 References: https://github.com/swaywm/wlroots/pull/2615#issuecomment-756687006
2021-01-16render: remove egl include from wlr_rendererSimon Zeni
2021-01-16render: drop egl parameters from wlr_renderer_autocreateSimon Zeni
2021-01-16backend/drm: implement get_drm_fdSimon Ser
2021-01-14backend: remove unnecessary GLES2 includesSimon Ser
2021-01-13backend/drm: remove unnecessary wlr_drm_fb.wlr_buf checkSimon Ser
We don't need this check, wlr_buf is guaranteed not to be NULL.
2021-01-12backend/drm: fix segfault in page_flip_handlerSimon Ser
Since 5b1b43c68c7a ("backend/drm: make wlr_drm_plane.{pending,queued,current}_fb pointers"), current_fb can be NULL if there's no buffer. If current_fb is not NULL, current_fb->wlr_buf is guaranteed to not be NULL. Closes: https://github.com/swaywm/wlroots/issues/2634