WESTON: patch backport and drm fix
- clients: close unused keymap fd This patch is already merged upstream and solves a crash during suspend/resume. - drm: fix race during system suspend
This commit is contained in:
parent
e759c95d9b
commit
7bc347c769
|
|
@ -0,0 +1,74 @@
|
|||
From dc6538a73577ee23841ea3c5150b3907a7cef04a Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Borneo <borneo.antonio@gmail.com>
|
||||
Date: Mon, 29 Apr 2019 17:54:10 +0200
|
||||
Subject: [PATCH] clients: close unused keymap fd
|
||||
|
||||
commit 4071225cdc12a36a08ddd3102a3dd17d4006c320 upstream.
|
||||
|
||||
In the simple examples in which keymap is not handled, the open
|
||||
descriptor has to be properly closed.
|
||||
|
||||
After each suspend/resume sequence the keymap is send again to
|
||||
every client. On client weston-simple-egl the leak causes a
|
||||
segfault when no more file descriptors can be opened.
|
||||
|
||||
Close the file descriptor and lazily copy/paste the comment
|
||||
already available in simple-dmabuf-v4l.
|
||||
|
||||
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
|
||||
---
|
||||
clients/multi-resource.c | 2 ++
|
||||
clients/simple-egl.c | 2 ++
|
||||
clients/weston-info.c | 3 +++
|
||||
3 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/clients/multi-resource.c b/clients/multi-resource.c
|
||||
index 2be0a7e3..0a035118 100644
|
||||
--- a/clients/multi-resource.c
|
||||
+++ b/clients/multi-resource.c
|
||||
@@ -296,6 +296,8 @@ static void
|
||||
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
|
||||
uint32_t format, int fd, uint32_t size)
|
||||
{
|
||||
+ /* Just so we don’t leak the keymap fd */
|
||||
+ close(fd);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
|
||||
index a1e57aef..ac99b449 100644
|
||||
--- a/clients/simple-egl.c
|
||||
+++ b/clients/simple-egl.c
|
||||
@@ -695,6 +695,8 @@ static void
|
||||
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
|
||||
uint32_t format, int fd, uint32_t size)
|
||||
{
|
||||
+ /* Just so we don’t leak the keymap fd */
|
||||
+ close(fd);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/clients/weston-info.c b/clients/weston-info.c
|
||||
index 609e270a..20c96d0f 100644
|
||||
--- a/clients/weston-info.c
|
||||
+++ b/clients/weston-info.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
@@ -435,6 +436,8 @@ static void
|
||||
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
|
||||
uint32_t format, int fd, uint32_t size)
|
||||
{
|
||||
+ /* Just so we don’t leak the keymap fd */
|
||||
+ close(fd);
|
||||
}
|
||||
|
||||
static void
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
From 084d5600c6b8ff7189b40f5a0a844ea602e0d428 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Borneo <antonio.borneo@st.com>
|
||||
Date: Mon, 27 May 2019 17:06:33 +0200
|
||||
Subject: [PATCH] backend-drm: fix race during system suspend
|
||||
|
||||
Depending on system loading, weston-launcher could drop the drm
|
||||
master access before 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.
|
||||
|
||||
Only for atomic modesetting, cancel current repaint in case of
|
||||
EACCES.
|
||||
No need to wait for suspend or for any notification; in case the
|
||||
client reschedules and try a repaint, it will get EACCES again.
|
||||
At resume, damage-all guarantees a complete repaint.
|
||||
|
||||
Non-atomic modesetting suffers from similar problems, but it is
|
||||
not fixed by this change. Since drm_pending_state_apply() never
|
||||
returns error for non-atomic modesetting, this change has no
|
||||
impact on non-atomic modesetting.
|
||||
|
||||
Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
|
||||
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/117
|
||||
---
|
||||
libweston/compositor-drm.c | 15 +++++++++++++--
|
||||
libweston/compositor.c | 2 +-
|
||||
libweston/compositor.h | 2 ++
|
||||
3 files changed, 16 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
|
||||
index 3891176..d88bc1e 100644
|
||||
--- a/libweston/compositor-drm.c
|
||||
+++ b/libweston/compositor-drm.c
|
||||
@@ -2885,7 +2885,9 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
|
||||
ret = drm_pending_state_apply(pending_state);
|
||||
if (ret != 0) {
|
||||
weston_log("applying repaint-start state failed: %m\n");
|
||||
- goto finish_frame;
|
||||
+ if (ret != -EACCES)
|
||||
+ goto finish_frame;
|
||||
+ weston_output_schedule_repaint_reset(output_base);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -2987,8 +2989,17 @@ drm_repaint_flush(struct weston_compositor *compositor, void *repaint_data)
|
||||
{
|
||||
struct drm_backend *b = to_drm_backend(compositor);
|
||||
struct drm_pending_state *pending_state = repaint_data;
|
||||
+ struct weston_output *output;
|
||||
+ int ret;
|
||||
|
||||
- drm_pending_state_apply(pending_state);
|
||||
+ ret = drm_pending_state_apply(pending_state);
|
||||
+ if (ret == -EACCES) {
|
||||
+ weston_log("failed repaint flush: Permission denied\n");
|
||||
+ wl_list_for_each(output, &compositor->output_list, link) {
|
||||
+ if (output->repainted)
|
||||
+ weston_output_schedule_repaint_reset(output);
|
||||
+ }
|
||||
+ }
|
||||
b->repaint_data = NULL;
|
||||
}
|
||||
|
||||
diff --git a/libweston/compositor.c b/libweston/compositor.c
|
||||
index 9deb781..51705f7 100644
|
||||
--- a/libweston/compositor.c
|
||||
+++ b/libweston/compositor.c
|
||||
@@ -2435,7 +2435,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data)
|
||||
return r;
|
||||
}
|
||||
|
||||
-static void
|
||||
+WL_EXPORT void
|
||||
weston_output_schedule_repaint_reset(struct weston_output *output)
|
||||
{
|
||||
output->repaint_status = REPAINT_NOT_SCHEDULED;
|
||||
diff --git a/libweston/compositor.h b/libweston/compositor.h
|
||||
index 8b7a102..4f9b989 100644
|
||||
--- a/libweston/compositor.h
|
||||
+++ b/libweston/compositor.h
|
||||
@@ -1704,6 +1704,8 @@ weston_output_finish_frame(struct weston_output *output,
|
||||
void
|
||||
weston_output_schedule_repaint(struct weston_output *output);
|
||||
void
|
||||
+weston_output_schedule_repaint_reset(struct weston_output *output);
|
||||
+void
|
||||
weston_output_damage(struct weston_output *output);
|
||||
void
|
||||
weston_compositor_schedule_repaint(struct weston_compositor *compositor);
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
|
@ -5,3 +5,5 @@ SRC_URI_append_stm32mpcommon = " file://0001-desktop-shell-always-paint-backgrou
|
|||
SRC_URI_append_stm32mpcommon = " file://0002-desktop-shell-allow-to-center-background-image.patch "
|
||||
SRC_URI_append_stm32mpcommon = " file://0003-Allow-to-get-hdmi-output-with-several-outputs.patch "
|
||||
SRC_URI_append_stm32mpcommon = " file://0004-Force-to-close-all-output.patch "
|
||||
SRC_URI_append_stm32mpcommon = " file://0005-clients-close-unused-keymap-fd.patch "
|
||||
SRC_URI_append_stm32mpcommon = " file://0006-backend-drm-fix-race-during-system-suspend.patch "
|
||||
|
|
|
|||
Loading…
Reference in New Issue