backend-drm: reorder plane checks to avoid unnecessary rendering
authorMichael Olbrich <m.olbrich@pengutronix.de>
Tue, 14 Jul 2020 09:18:54 +0000 (11:18 +0200)
committerDaniel Stone <daniels@collabora.com>
Mon, 17 Aug 2020 09:53:38 +0000 (09:53 +0000)
If a surface is not visible, then is does not matter if the view is on multiple
outputs. It will be skipped anyways when the output is rendered.

So check first if the surface is acually visible on the output before doing any
checks that might force rendering. This avoids unnecessary rendering.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
libweston/backend-drm/state-propose.c

index 767c34f463cdfb466e1757d9b36fdb1b24431138..b403e304cd1ed512a2501b44a80dc76780e12567 100644 (file)
@@ -862,20 +862,6 @@ drm_output_propose_state(struct weston_output *output_base,
                        continue;
                }
 
-               /* We only assign planes to views which are exclusively present
-                * on our output. */
-               if (ev->output_mask != (1u << output->base.id)) {
-                       drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane "
-                                    "(on multiple outputs)\n", ev);
-                       force_renderer = true;
-               }
-
-               if (!weston_view_has_valid_buffer(ev)) {
-                       drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane "
-                                    "(no buffer available)\n", ev);
-                       force_renderer = true;
-               }
-
                /* Ignore views we know to be totally occluded. */
                pixman_region32_init(&clipped_view);
                pixman_region32_intersect(&clipped_view,
@@ -897,6 +883,20 @@ drm_output_propose_state(struct weston_output *output_base,
                        continue;
                }
 
+               /* We only assign planes to views which are exclusively present
+                * on our output. */
+               if (ev->output_mask != (1u << output->base.id)) {
+                       drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane "
+                                    "(on multiple outputs)\n", ev);
+                       force_renderer = true;
+               }
+
+               if (!weston_view_has_valid_buffer(ev)) {
+                       drm_debug(b, "\t\t\t\t[view] not assigning view %p to plane "
+                                    "(no buffer available)\n", ev);
+                       force_renderer = true;
+               }
+
                /* Since we process views from top to bottom, we know that if
                 * the view intersects the calculated renderer region, it must
                 * be part of, or occluded by, it, and cannot go on a plane. */