commit 2c1078c

Michael Forney  ·  2014-08-03 02:38:05 +0000 UTC
parent 18acb9d
compositor: Handle EACCES when view_attach fails

This also changes perform_update to add screens to the pending_flips
mask only after the attach succeeded. This way, when an attach fails, we
still try to update that screen later on.
1 files changed,  +16, -11
+16, -11
 1@@ -149,17 +149,10 @@ static void handle_screen_view_event(struct wl_listener * listener, void * data)
 2     }
 3 }
 4 
 5-static bool target_swap_buffers(struct target * target)
 6+static int target_swap_buffers(struct target * target)
 7 {
 8     target->next_buffer = wld_surface_take(target->surface);
 9-
10-    if (!view_attach(target->view, target->next_buffer))
11-    {
12-        ERROR("Failed to attach next frame to screen\n");
13-        return false;
14-    }
15-
16-    return true;
17+    return view_attach(target->view, target->next_buffer);
18 }
19 
20 static struct target * target_new(struct screen * screen)
21@@ -709,7 +702,20 @@ static void update_screen(struct screen * screen)
22     pixman_region32_subtract(&base_damage, total_damage, &compositor.opaque);
23     renderer_repaint(target, total_damage, &base_damage, &compositor.views);
24     pixman_region32_fini(&base_damage);
25-    target_swap_buffers(target);
26+
27+    switch (target_swap_buffers(target))
28+    {
29+        case -EACCES:
30+            /* If we get an EACCES, it is because this session is being
31+             * deactivated, but we haven't yet received the deactivate signal
32+             * from swc-launch. */
33+            compositor.active = false;
34+            compositor.scheduled_updates = 0;
35+            break;
36+        case 0:
37+            compositor.pending_flips |= screen_mask(screen);
38+            break;
39+    }
40 }
41 
42 static void perform_update(void * data)
43@@ -731,7 +737,6 @@ static void perform_update(void * data)
44 
45     /* XXX: Should assert that all damage was covered by some output */
46     pixman_region32_clear(&compositor.damage);
47-    compositor.pending_flips |= updates;
48     compositor.scheduled_updates &= ~updates;
49     compositor.updating = false;
50 }