1From 1349a444c8de510af86acec77e437a1c1b30768f Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Fri, 13 Aug 2021 10:10:01 +0800
4Subject: [PATCH 52/93] backend-drm: Allow pageflip error
5
6Allow to recover from pageflip error:
7[02:08:14.089] queueing pageflip failed: Operation not permitted
8[02:08:14.090] Couldn't apply state for output eDP-1
9[02:08:14.090] repaint-flush failed: No such file or directory
10
11Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
12---
13 libweston/backend-drm/kms.c | 8 ++++++--
14 1 file changed, 6 insertions(+), 2 deletions(-)
15
16diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c
17index 52f0c68..690ada0 100644
18--- a/libweston/backend-drm/kms.c
19+++ b/libweston/backend-drm/kms.c
20@@ -1382,6 +1382,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state)
21 	struct drm_backend *b = device->backend;
22 	struct drm_output_state *output_state, *tmp;
23 	struct drm_crtc *crtc;
24+	int has_error = 0;
25
26 	if (device->atomic_modeset)
27 		return drm_pending_state_apply_atomic(pending_state,
28@@ -1424,6 +1425,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state)
29 				drm_output_fini_egl(output);
30 				drm_output_init_egl(output, b);
31 			}
32+			has_error = 1;
33 		}
34 	}
35
36@@ -1431,7 +1433,7 @@ drm_pending_state_apply(struct drm_pending_state *pending_state)
37
38 	drm_pending_state_free(pending_state);
39
40-	return 0;
41+	return has_error ? -EACCES : 0;
42 }
43
44 /**
45@@ -1447,6 +1449,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state)
46 	struct drm_device *device = pending_state->device;
47 	struct drm_output_state *output_state, *tmp;
48 	struct drm_crtc *crtc;
49+	int has_error = 0;
50
51 	if (device->atomic_modeset)
52 		return drm_pending_state_apply_atomic(pending_state,
53@@ -1475,6 +1478,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state)
54 		if (ret != 0) {
55 			weston_log("Couldn't apply state for output %s\n",
56 				   output_state->output->base.name);
57+			has_error = 1;
58 		}
59 	}
60
61@@ -1482,7 +1486,7 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state)
62
63 	drm_pending_state_free(pending_state);
64
65-	return 0;
66+	return has_error ? -EACCES : 0;
67 }
68
69 void
70--
712.20.1
72
73