[PATCH weston v5 34/42] compositor-drm: Don't repaint if no damage

Daniel Stone daniels at collabora.com
Wed Nov 16 14:25:26 UTC 2016


If we don't have any damage for the primary plane, then don't force a
repaint; simply reuse the old buffer we already have.

Signed-off-by: Daniel Stone <daniels at collabora.com>

Differential Revision: https://phabricator.freedesktop.org/D1499
---
 libweston/compositor-drm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 4342a3d..95f7f8d 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1406,6 +1406,7 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage)
 {
 	struct weston_compositor *c = output->base.compositor;
 	struct drm_plane_state *scanout_state;
+	struct drm_plane *scanout_plane = output->scanout_plane;
 	struct drm_backend *b = to_drm_backend(c);
 	struct drm_fb *fb;
 
@@ -1416,7 +1417,13 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage)
 	if (scanout_state->fb)
 		return;
 
-	if (b->use_pixman)
+	if (!pixman_region32_not_empty(damage) &&
+	    scanout_plane->state_cur->fb &&
+	    scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE &&
+	    scanout_plane->state_cur->fb->width == output->base.width &&
+	    scanout_plane->state_cur->fb->height == output->base.height)
+		fb = drm_fb_ref(scanout_plane->state_cur->fb);
+	else if (b->use_pixman)
 		fb = drm_output_render_pixman(output, damage);
 	else
 		fb = drm_output_render_gl(output, damage);
-- 
2.9.3



More information about the wayland-devel mailing list