mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-18 05:34:29 -04:00
backend/drm: introduce page-flip tracking struct
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
This commit is contained in:
parent
c9c9dd6a5b
commit
3b53d1cbf1
6 changed files with 76 additions and 47 deletions
|
|
@ -61,13 +61,14 @@ static void atomic_begin(struct atomic *atom) {
|
|||
}
|
||||
|
||||
static bool atomic_commit(struct atomic *atom,
|
||||
struct wlr_drm_connector *conn, uint32_t flags) {
|
||||
struct wlr_drm_connector *conn, struct wlr_drm_page_flip *page_flip,
|
||||
uint32_t flags) {
|
||||
struct wlr_drm_backend *drm = conn->backend;
|
||||
if (atom->failed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int ret = drmModeAtomicCommit(drm->fd, atom->req, flags, drm);
|
||||
int ret = drmModeAtomicCommit(drm->fd, atom->req, flags, page_flip);
|
||||
if (ret != 0) {
|
||||
wlr_drm_conn_log_errno(conn,
|
||||
(flags & DRM_MODE_ATOMIC_TEST_ONLY) ? WLR_DEBUG : WLR_ERROR,
|
||||
|
|
@ -257,8 +258,8 @@ static void set_plane_props(struct atomic *atom, struct wlr_drm_backend *drm,
|
|||
}
|
||||
|
||||
static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
||||
const struct wlr_drm_connector_state *state, uint32_t flags,
|
||||
bool test_only) {
|
||||
const struct wlr_drm_connector_state *state,
|
||||
struct wlr_drm_page_flip *page_flip, uint32_t flags, bool test_only) {
|
||||
struct wlr_drm_backend *drm = conn->backend;
|
||||
struct wlr_output *output = &conn->output;
|
||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||
|
|
@ -367,7 +368,7 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
|
|||
}
|
||||
}
|
||||
|
||||
bool ok = atomic_commit(&atom, conn, flags);
|
||||
bool ok = atomic_commit(&atom, conn, page_flip, flags);
|
||||
atomic_finish(&atom);
|
||||
|
||||
if (ok && !test_only) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue