[PATCH weston v5 06/42] compositor-drm: Extract EGL destroy to helper

Daniel Stone daniels at collabora.com
Wed Nov 16 14:24:58 UTC 2016


No functional change.

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

Differential Revision: https://phabricator.freedesktop.org/D1484
---
 libweston/compositor-drm.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 2d5faa0..5fb45b4 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1322,9 +1322,6 @@ drm_assign_planes(struct weston_output *output_base)
 	pixman_region32_fini(&overlap);
 }
 
-static void
-drm_output_fini_pixman(struct drm_output *output);
-
 /**
  * Find the closest-matching mode for a given target
  *
@@ -1363,8 +1360,12 @@ choose_mode (struct drm_output *output, struct weston_mode *target_mode)
 
 static int
 drm_output_init_egl(struct drm_output *output, struct drm_backend *b);
+static void
+drm_output_fini_egl(struct drm_output *output);
 static int
 drm_output_init_pixman(struct drm_output *output, struct drm_backend *b);
+static void
+drm_output_fini_pixman(struct drm_output *output);
 
 static int
 drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mode)
@@ -1414,9 +1415,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
 			return -1;
 		}
 	} else {
-		gl_renderer->output_destroy(&output->base);
-		gbm_surface_destroy(output->gbm_surface);
-
+		drm_output_fini_egl(output);
 		if (drm_output_init_egl(output, b) < 0) {
 			weston_log("failed to init output egl state with "
 				   "new mode");
@@ -1853,6 +1852,13 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
 	return 0;
 }
 
+static void
+drm_output_fini_egl(struct drm_output *output)
+{
+	gl_renderer->output_destroy(&output->base);
+	gbm_surface_destroy(output->gbm_surface);
+}
+
 static int
 drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
 {
@@ -2423,12 +2429,10 @@ drm_output_deinit(struct weston_output *base)
 	struct drm_output *output = to_drm_output(base);
 	struct drm_backend *b = to_drm_backend(base->compositor);
 
-	if (b->use_pixman) {
+	if (b->use_pixman)
 		drm_output_fini_pixman(output);
-	} else {
-		gl_renderer->output_destroy(&output->base);
-		gbm_surface_destroy(output->gbm_surface);
-	}
+	else
+		drm_output_fini_egl(output);
 
 	weston_plane_release(&output->fb_plane);
 	weston_plane_release(&output->cursor_plane);
-- 
2.9.3



More information about the wayland-devel mailing list