Age | Commit message (Collapse) | Author |
|
Improves readability, no functional change.
|
|
Only print the list of connectors once, with both the old and new
status. Use CRTC object IDs instead of CRTC indices. Make it obvious
when a connector keeps the same CRTC.
|
|
If a connector has no current/queued buffer, but has a pending
buffer in the commit, we need to process that pending buffer before
checking pending.primary_fb.
|
|
When turning off a CRTC, we don't need a buffer.
It doesn't matter whether this is a modeset or not: we always need
a buffer even for regular page-flips as long as a connector is
active.
Fixes: 374daeb25603 ("backend/drm: Ensure a primary fb is available when configuring an output")
|
|
Use the helper instead of hand-rolling the logic.
|
|
|
|
We can never hit the case where we try to light up an output without
a buffer. output_ensure_buffer() will catch this for now, and when that's
removed, output_basic_test() will catch this case.
|
|
drm_connect_state_init() will set primary_fd to null if no CRTC is active
for the connector and can crash later if the code expects a CRTC (like
when lighting up an output).
|
|
init_plane tries to free a single plane on error, but this is an element
in a calloc'd array by the caller that we should not touch.
|
|
|
|
On startup, we fetch the previous MODE_ID blob ID so that
compositors can keep using the previous mode if they want to.
However, that blob doesn't belong to us, it belongs to the
previous DRM master. As a result, we get an error when trying to
destroy it.
Fix this by tracking whether the blob belongs to us or not.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3811
|
|
Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead,
require POSIX.1-2008 globally. A lot of core source files depend
on that already.
Some care must be taken on a few select files where we need a bit
more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and
some files need BSD extensions (_DEFAULT_SOURCE). In both cases,
these feature test macros imply _POSIX_C_SOURCE. Make sure to not
define both these macros and _POSIX_C_SOURCE explicitly to avoid
POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001
but _XOPEN_SOURCE says POSIX.1-2008).
Additionally, there is one special case in render/vulkan/vulkan.c.
That file needs major()/minor(), and these are system-specific.
On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need
to make sure it's not defined for this file. On Linux, we can
explicitly include <sys/sysmacros.h> and ensure that apart from
symbols defined there the file only uses POSIX toys.
|
|
If all connectors and planes already have the right CRTC set, or
are disabled, we can skip the device-wide reset after a VT switch.
I've contemplated using a more fine-grained logic to only reset
the connectors, CRTCs and planes that need to be migrated. However,
writing a correct algorithm for this would be quite involved, and it
doesn't seem worth the trouble anyways.
Closes: https://github.com/swaywm/sway/issues/7956
|
|
|
|
We'll need to use a bunch of internal functions from that file in
the next commits.
|
|
Allows the KMS driver to parallelize the modesets, so should be
faster than going through each CRTC one by one.
|
|
This function fetches property IDs. These don't change for the
lifetime of the connector. Instead of refreshing the property IDs
on hotplug (and leaving property IDs unset for disconnected
connectors), only fetch the property IDs when we create the
connector.
|
|
|
|
|
|
Centralizes the logic to destroy a DRM blob: check whether it's
zero, and print a nice error message.
|
|
No need for this, the backend can be grabbed from the connector.
|
|
|
|
|
|
We only need base POSIX here.
|
|
Since we only use the backend capabilities here we can simply pass
them in directly. This allows other locations to create an allocator
even if they don't have a backend. They can simply specify the caps
they want instead.
|
|
This also fixes a memleak.
|
|
The kernel patches [1] have been merged.
[1]: https://patchwork.freedesktop.org/series/120103/
|
|
We can grab the event loop from the wlr_session instead.
|
|
Leave it up to the compositor to decide what to do when a backend
becomes unavailable.
|
|
wlr_output.refresh is populated by core wlr_output, and thus will
be zero for a custom mode with an unset refresh rate.
Save the refresh rate from the drmModeModeInfo in wlr_drm_connector
instead.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3791
|
|
It can be useful for compositors to get the real DRM FD instead of
the one from the parent compositor. For instance, some compositors
might want to perform some DRM IOCTLs there to check the driver
name, fetch some DRM resources, etc. This will also be a requirement
for direct scanout on secondary GPUs.
|
|
Allows compositors to figure out whether a DRM backend is
secondary on a multi-GPU setup.
|
|
This is unused.
|
|
This function touches queued_fb/current_fb, which the renderer has
nothing to do with.
|
|
|
|
RMFB implicitly performs a modeset to turn off any CRTC which is
using the FB. This prevents seamless transitions between two DRM
masters from working.
Use the new CLOSEFB IOCTL which doesn't turn off anything and leave
it up to the compositor to turn off outputs on shutdown if it wants
to.
|
|
Many files used to require wlr_matrix but no longer do.
|
|
We don't need the whole wl_display here anymore. The wl_event_loop
is enough.
|
|
wl_display holds a lot more than wlr_session needs: wlr_session
only needs to wait for a FD to become readable, but wl_display
provides full access to the Wayland client and protocol objects.
Switch to wl_event_loop to better reflect the above.
|
|
These aren't really tied to wlr_output.
|
|
drm_crtc_commit() already ensures that atomic-only flags are
disallowed.
|
|
Instead of having this condition checked in multiple places,
centralize it so that they don't go out-of-sync.
|
|
This chunk of code was moved by mistake.
Fixes: 3b53d1cbf199 ("backend/drm: introduce page-flip tracking struct")
|
|
When we destroy the backend, page flips will no longer be invoked meaning
those won't clean up the page flips for us.
|
|
|
|
Introduce a per-page-flip tracking struct passed to the kernel
when we request a page-flip event for an atomic commit. The kernel
will pass us back this pointer when delivering the event.
This eliminates any risk of mixing up events together. In particular,
if two events are pending, or if the CRTC of a connector is swapped,
we no longer blow up in the page-flip event handler.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3753
|
|
since 4932e0d347f("backend/drm: ensure plane surfaces are cleaned up on shutdown")
at finish_drm_resources called drm_plane_finsh_surface has already free the fb
Signed-off-by: zhoulei zhoulei@kylinos.cn
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
|
|
This avoids a black screen during multiple seconds on shutdown.
To fully allow for flicker-free transitions between DRM masters,
we will also need [1].
[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4394
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3497
|
|
Right now this is done "by chance" because we disable all CRTCs
on shutdown. However, we'll stop doing this. Plus, if disabling
a CRTC fails, we don't cleanup properly.
|
|
We can just assume CLOCK_MONOTONIC everywhere.
Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
|