[PATCH weston v5 11/11] drm: Drop use of drm_config config wrapper

Bryce Harrington bryce at osg.samsung.com
Wed Apr 13 10:25:15 UTC 2016


With the use_current_mode moved into the main config class, this small
wrapper is redundant.  Dropping it helps make the drm backend config
initialization more consistent with the other backends.

Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 src/main.c | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/src/main.c b/src/main.c
index 6463e7a..8ec8701 100644
--- a/src/main.c
+++ b/src/main.c
@@ -688,12 +688,6 @@ load_backend_new(struct weston_compositor *compositor, const char *backend,
 }
 
 
-// TODO: Why is there a wrapper around the drm config base object?
-struct drm_config {
-	struct weston_drm_backend_config base;
-	bool use_current_mode;
-};
-
 static enum weston_drm_backend_output_mode
 drm_configure_output(struct weston_compositor *c,
 		     bool use_current_mode,
@@ -740,39 +734,38 @@ static int
 load_drm_backend(struct weston_compositor *c, const char *backend,
 		 int *argc, char **argv, struct weston_config *wc)
 {
-	struct drm_config *config;
+	struct weston_drm_backend_config *config;
 	struct weston_config_section *section;
 	int ret = 0;
 
-	config = zalloc(sizeof (struct drm_config));
+	config = zalloc(sizeof (struct weston_drm_backend_config));
 	if (!config)
 		return -1;
 
 	const struct weston_option options[] = {
-		{ WESTON_OPTION_INTEGER, "connector", 0, &config->base.connector },
-		{ WESTON_OPTION_STRING, "seat", 0, &config->base.seat_id },
-		{ WESTON_OPTION_INTEGER, "tty", 0, &config->base.tty },
-		{ WESTON_OPTION_BOOLEAN, "current-mode", 0,
-		  &config->use_current_mode },
-		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config->base.use_pixman },
+		{ WESTON_OPTION_INTEGER, "connector", 0, &config->connector },
+		{ WESTON_OPTION_STRING, "seat", 0, &config->seat_id },
+		{ WESTON_OPTION_INTEGER, "tty", 0, &config->tty },
+		{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &config->use_current_mode },
+		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config->use_pixman },
 	};
 
 	parse_options(options, ARRAY_LENGTH(options), argc, argv);
 
 	section = weston_config_get_section(wc, "core", NULL, NULL);
 	weston_config_section_get_string(section,
-					 "gbm-format", &config->base.gbm_format,
+					 "gbm-format", &config->gbm_format,
 					 NULL);
 
-	config->base.base.struct_version = 1;
-	config->base.base.struct_size = sizeof(struct weston_drm_backend_config);
-	config->base.configure_output = drm_configure_output;
+	config->base.struct_version = 1;
+	config->base.struct_size = sizeof(struct weston_drm_backend_config);
+	config->configure_output = drm_configure_output;
 
 	ret = load_backend_new(c, backend,
-			       (struct weston_backend_config *)(&config->base));
+			       (struct weston_backend_config *)config);
 
-	free(config->base.gbm_format);
-	free(config->base.seat_id);
+	free(config->gbm_format);
+	free(config->seat_id);
 	free(config);
 
 	return ret;
-- 
1.9.1



More information about the wayland-devel mailing list