aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
AgeCommit message (Collapse)Author
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-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-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-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
2021-01-10backend/drm: only keep track of local bufferSimon Ser
Stop keeping track of buffers on the parent GPU when multi-GPU is used. This removes support for export_dmabuf on secondary GPUs, but renderer v6 will bring this back by managing the swapchains in wlr_output instead of the backends.
2021-01-10backend/drm: make wlr_drm_plane.{pending,queued,current}_fb pointersSimon Ser
This will be useful once we start re-using wlr_drm_fb.
2021-01-03backend/drm: stash pending page-flip CRTCSimon Ser
wlr_drm_connector.crtc may be updated by the DRM backend while a page-flip is pending. In this case, the page-flip handler won't be able to find the right wlr_drm_connector from the CRTC ID. Save the CRTC when performing a page-flip to ensure we always find the right connector when we get the event.
2020-12-30backend/drm: remove special linear case for cursor planeSimon Ser
We now properly mark the cursor plane's formats as linear-only, and we now have a version of wlr_drm_format_intersect that handles the case of linear-only formats and implicit modifiers. We can remove the special drm_plane_init_surface flag we had for cursor planes. This also allows us to use a non-linear layout for cursor planes on drivers that support it. Tested on amdgpu GFX9.
2020-12-30backend/drm: force LINEAR for cursor plane formatsSimon Ser
If the kernel driver doesn't support modifiers, it still expects cursor FBs to have a LINEAR layout. See [1] for expectations for framebuffers attached to the cursor plane. [1]: https://patchwork.freedesktop.org/patch/408512/
2020-12-25Stop using wlr_texture_get_sizeSimon Ser
Just use wlr_texture.{width,height} directly.
2020-12-24backend/drm: make drmModePlane arg in add_plane constSimon Ser
Make it clearer it'll be free'd after add_plane returns.
2020-12-24backend/drm: add special case for cursor in add_planeSimon Ser
The code calling add_plane now makes sure not to add a cursor plane to a CRTC which already has one.
2020-12-24backend/drm: log whether ADDFB2 modifiers are supportedSimon Ser
2020-12-23backend/drm: don't retry page-flip when modifiers are unsupportedSimon Ser
Parse WLR_DRM_NO_MODIFIERS at startup. Don't parse IN_FORMATS when WLR_DRM_NO_MODIFIERS is set, so that the legacy behaviour is better reproduced. When modifiers aren't supported, try the initial page-flip once only.
2020-12-23backend/drm: use plural form for possible_crtcsSimon Ser
Make it clearer that this is a bitmask of CRTC indices.
2020-12-22backend/drm: assert connector state after wlr_output_destroySimon Ser
2020-12-22backend/drm: destroy DRM connectors that disappearSimon Ser
This was lost during the refactoring. We were previously calling wlr_output_destroy, which destroyed the connector as well. Fixes: 248c7787c7b4 ("backend/drm: refactor wlr_output destruction")
2020-12-22backend/drm: remove drm_fb_acquireSimon Ser
Instead, import the buffer into GBM and KMS in drm_fb_import. Also move the multi-GPU copy there if necessary.
2020-12-22backend/drm: grab DMA-BUF from wlr_buffer instead of gbm_boSimon Ser
Get the DMA-BUF directly out of the wlr_buffer instead of relying on the gbm_bo. This eliminates a roundtrip through GBM.
2020-12-18backend/drm: avoid gcc stringop-truncation warningRonan Pigott
2020-12-18backend/drm: remove unused wlr_drm_plane.drm_formatSimon Ser
2020-12-18backend/drm: refactor wlr_output destructionSimon Ser
Instead of hand-rolling our own manual wlr_output cleanup function, rely on wlr_output_destroy to remove an output from the compositor's state.
2020-12-18backend/drm: introduce wlr_drm_connector.nameSimon Ser
The DRM backend is a little special when it comes to wlr_outputs: the wlr_drm_connectors are long-lived and are created even when no screen is connected. A wlr_drm_connector only advertises a wlr_output to the compositor when a screen is connected. As such, most of wlr_output's state is invalid when the connector is disconnected. We want to stop using wlr_output state on disconnected connectors. Introduce wlr_drm_connector.name which is always valid regardless of the connector status to avoid reading wlr_output.name when disconnected.
2020-12-18backend/drm: introduce wlr_drm_conn_logSimon Ser
Simplify and unify connector-specific logging with a new wlr_drm_conn_log macro. This makes it easier to understand which connector a failure is about, without having to explicitly integrate the connector name in each log message.
2020-12-17backend/drm: print DRM device name when scanning connectorsSimon Ser
2020-12-17backend/drm: remove nouveau workaroundSimon Ser
The workaround is broken because drm_fb_acquire doesn't leave the EGL context current anymore. We'll need to re-introduce it. References: https://github.com/swaywm/wlroots/issues/2525
2020-12-15backend/drm: add wlr_drm_connector.backendSimon Ser
This allows the DRM code to have direct access to the wlr_drm_backend without having to go through an upcast via get_drm_backend_from_backend.
2020-12-13backend/drm: stop using GBM flagsSimon Ser
gbm_bo_create_with_modifiers doesn't take GBM flags, so our wlr_gbm_allocator interface doesn't either. We were still internally using GBM flags in the DRM backend, leading to awkward back-and-forth conversions. The only flag passed to drm_plane_init_surface was GBM_BO_USE_LINEAR, so turn that into a bool to make sure other flags can't be passed in. Move the "force linear" logic out of init_drm_surface, because the supplied wlr_drm_format should already contain that information.
2020-12-11backend/drm: remove workaround for amdgpu DP MSTSimon Ser
Closes: https://github.com/swaywm/wlroots/issues/2533
2020-12-09backend/drm: remove EGL configSimon Ser
Since we're using wlr_swapchain, we don't need to provide an EGL config.
2020-12-08backend/drm: don't assume possible_crtcs has only one bit setStephane Chauveau
This isn't necessarily the case [1]. This should fix an assertion failure on Raspberry Pi 4 dual screen. [1]: https://lists.freedesktop.org/archives/dri-devel/2020-August/275142.html Closes: https://github.com/swaywm/wlroots/issues/1943 Co-authored-by: Simon Ser <contact@emersion.fr>
2020-12-08backend/drm: stop tracking overlay planesSimon Ser
We don't do anything with them. Once we do, we can easily add this back.
2020-12-07drm: do not unset make/model before emitting destroy eventIlia Bozhinov
2020-12-04backend/drm: remove unused if in drm_connector_move_cursorSimon Ser
We return early if we don't have a plane.
2020-12-01Revert "backend/drm: stop force-probing connectors"Simon Ser
This reverts commit 713c1661b742f93a7d2167321837c0d99541ca87. It turns out we do need to force-probe on startup and on hotplug [1]. This is unfortunate, but that's just how the uAPI works. Fixing this would require patching the kernel. [1]: https://lists.freedesktop.org/archives/dri-devel/2020-November/289506.html Closes: https://github.com/swaywm/wlroots/issues/2499
2020-11-24backend/drm: stop force-probing connectorsSimon Ser
After discussing with Pekka and Daniel on #dri-devel, we concluded [1] that user-space shouldn't need to force-probe connectors. Force-probing can take some time, so using drmModeGetConnectorCurrent can result in faster start-up. Users can manually trigger a force-probe if necessary: echo detect | sudo tee /sys/class/drm/card0-DP-1/status Or just by running a tool like drm_info. A similar change has been submitted to Weston [2]. [1]: https://lists.freedesktop.org/archives/dri-devel/2020-November/287728.html [2]: https://gitlab.freedesktop.org/wayland/weston/-/issues/437
2020-11-19backend/drm: Use legacy gamma size for legacy backendKenny Levinsen
We would always return the GAMMA_LUT_SIZE property if available, and only fall back to legacy gamma size otherwise. This leads to issues if both are available in differs in size while we use the legacy backend. Ensure that we only return the legacy size if we're using the legacy backend. Closes: https://github.com/swaywm/wlroots/issues/2429
2020-11-15backend/drm: check drm_surface_render_black_frame return valueSimon Ser
This avoids hitting an assertion in drm_fb_lock_surface when we failed to render a black frame.
2020-11-15backend/drm: get rid of wlr_drm_fb_typeSimon Ser
Since all DRM FBs are backed by a wlr_buffer, there's no need for this anymore.
2020-11-15backend/drm: add support for wlr_swapchain buffer ageSimon Ser
2020-11-15backend/drm: use wlr_swapchainSimon Ser
2020-11-05backend/drm: export pending FB in export_dmabuf, if anySimon Ser
This allows callers to grab the current frame right after committing it, without having to incur a full vblank worth of latency.
2020-11-03backend/drm: fix "a page-flip is already pending" errors on modesetSimon Ser
When performing a modeset, the DRM backend will request a page-flip event. However frame_pending wasn't set to true, so any subsequent wlr_output_schedule_frame calls would imemdiately trigger a synthetic frame event, asking the compositor to submit a new frame. Committing the new frame fails with "a page-flip is already pending" error in the DRM backend.