weston/libweston/backend-drm
Antonio Borneo c90fccc256 backend-drm: fix race during system suspend
Depending on system loading, weston-launcher could drop the drm
master access before the compositor and all the clients receive
the notification. In this case, some commit could be sent to the
drm driver too late and get refused with error EACCES.
This error condition is not properly managed and causes weston to
hang.

Change the return type of start_repaint_loop() and repaint_flush()
from void to int, and return 0 on success or -1 if the repaint has
to be cancelled.
In the callers of start_repaint_loop() and repaint_flush() handle
the return value and cancel the repaint when needed.
In backend-drm detect the error EACCES and return -1.
Note: to keep the code cleaner, this change inverts the execution
order between weston_output_schedule_repaint_reset() and
repaint_cancel().

No need to wait for suspend or for any notification; in case the
weston reschedules a repaint, it will get EACCES again.
At resume, damage-all guarantees a complete repaint.

This fix is for atomic modeset only.
Legacy modeset suffers from similar problems, but it is not fixed
by this change. Since drm_pending_state_apply() never returns
error for legacy modeset, this change has no impact on legacy
modeset.

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/117
2019-07-12 17:16:52 +00:00
..
drm-internal.h backend-drm: get handle in gbm specific code 2019-07-08 23:53:30 +02:00
drm.c backend-drm: fix race during system suspend 2019-07-12 17:16:52 +00:00
fb.c backend-drm: drop gbm.h from c files 2019-07-08 00:35:06 +02:00
kms.c backend-drm: get handle in gbm specific code 2019-07-08 23:53:30 +02:00
libbacklight.c backend-drm: move into new subdir 2019-05-16 13:32:34 +01:00
libbacklight.h backend-drm: move into new subdir 2019-05-16 13:32:34 +01:00
meson.build compositor-drm: Split assign_planes() into separate file 2019-06-26 23:08:36 +01:00
modes.c compositor-drm: Move mode handling to separate file 2019-06-26 23:08:36 +01:00
state-helpers.c compositor-drm: Move state helpers to separate file 2019-06-26 23:08:36 +01:00
state-propose.c compositor-drm: Split assign_planes() into separate file 2019-06-26 23:08:36 +01:00
vaapi-recorder.c backend-drm: move into new subdir 2019-05-16 13:32:34 +01:00
vaapi-recorder.h backend-drm: move into new subdir 2019-05-16 13:32:34 +01:00